Class JavaElementBase<E extends Element,T extends TypeMirror>

java.lang.Object
org.revapi.base.BaseElement<org.revapi.java.spi.JavaElement>
org.revapi.java.model.AbstractJavaElement
org.revapi.java.model.JavaElementBase<E,T>
All Implemented Interfaces:
Cloneable, Comparable<org.revapi.java.spi.JavaElement>, org.revapi.Element<org.revapi.java.spi.JavaElement>, org.revapi.java.spi.JavaElement, org.revapi.java.spi.JavaModelElement
Direct Known Subclasses:
FieldElement, MethodElement, MethodParameterElement, PackageElement, TypeElement

public abstract class JavaElementBase<E extends Element,T extends TypeMirror> extends AbstractJavaElement implements org.revapi.java.spi.JavaModelElement
Since:
0.1
Author:
Lukas Krejci
  • Field Details

    • element

      protected final E extends Element element
    • representation

      protected final T extends TypeMirror representation
  • Method Details

    • getHumanReadableElementType

      @Nonnull protected abstract String getHumanReadableElementType()
    • getParent

      @Nullable public org.revapi.java.spi.JavaModelElement getParent()
      Specified by:
      getParent in interface org.revapi.Element<E extends Element>
      Specified by:
      getParent in interface org.revapi.java.spi.JavaModelElement
      Overrides:
      getParent in class org.revapi.base.BaseElement<org.revapi.java.spi.JavaElement>
    • setParent

      public void setParent(@Nullable org.revapi.java.spi.JavaElement parent)
      Specified by:
      setParent in interface org.revapi.Element<E extends Element>
      Overrides:
      setParent in class org.revapi.base.BaseElement<org.revapi.java.spi.JavaElement>
    • getApi

      @Nonnull public org.revapi.API getApi()
      Specified by:
      getApi in interface org.revapi.Element<E extends Element>
      Overrides:
      getApi in class org.revapi.base.BaseElement<org.revapi.java.spi.JavaElement>
    • compareTo

      public int compareTo(@Nonnull org.revapi.java.spi.JavaElement o)
      Specified by:
      compareTo in interface Comparable<E extends Element>
    • getDeclaringElement

      public E getDeclaringElement()
      Specified by:
      getDeclaringElement in interface org.revapi.java.spi.JavaModelElement
    • getModelRepresentation

      public T getModelRepresentation()
      Specified by:
      getModelRepresentation in interface org.revapi.java.spi.JavaModelElement
    • isInherited

      public boolean isInherited()
      Specified by:
      isInherited in interface org.revapi.java.spi.JavaModelElement
    • setInherited

      public void setInherited(boolean inherited)
    • getFullHumanReadableString

      @Nonnull public final String getFullHumanReadableString()
      Specified by:
      getFullHumanReadableString in interface org.revapi.Element<E extends Element>
      Overrides:
      getFullHumanReadableString in class org.revapi.base.BaseElement<org.revapi.java.spi.JavaElement>
    • createFullHumanReadableString

      protected String createFullHumanReadableString()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • clone

      public JavaElementBase<E,T> clone()
      Overrides:
      clone in class org.revapi.base.BaseElement<org.revapi.java.spi.JavaElement>
    • cloneUnder

      public Optional<JavaElementBase<E,T>> cloneUnder(JavaElementBase<?,?> newParent)
      Clones this element and tries to add it under the new parent. If the parent already contains an element equivalent to this one, the returned optional is empty, otherwise it contains the clone.
      Parameters:
      newParent - the parent to add the clone to
      Returns:
      optional with the clone or an empty optional if the new parent already contains an equivalent element
    • lookupChildElement

      @Nullable public <X extends JavaElementBase<?, ?>> X lookupChildElement(Class<X> childType, String comparableSignature)
    • getComparableSignature

      protected String getComparableSignature()
    • createComparableSignature

      protected abstract String createComparableSignature()