Package org.revapi.java.model
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 Summary
Fields Modifier and Type Field Description protected E
element
protected T
representation
-
Fields inherited from class org.revapi.java.model.AbstractJavaElement
environment
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description JavaElementBase<E,T>
clone()
Optional<JavaElementBase<E,T>>
cloneUnder(JavaElementBase<?,?> newParent)
Clones this element and tries to add it under the new parent.int
compareTo(org.revapi.java.spi.JavaElement o)
protected abstract String
createComparableSignature()
protected String
createFullHumanReadableString()
boolean
equals(Object obj)
org.revapi.API
getApi()
protected String
getComparableSignature()
E
getDeclaringElement()
String
getFullHumanReadableString()
protected abstract String
getHumanReadableElementType()
T
getModelRepresentation()
org.revapi.java.spi.JavaModelElement
getParent()
int
hashCode()
boolean
isInherited()
<X extends JavaElementBase<?,?>>
XlookupChildElement(Class<X> childType, String comparableSignature)
void
setInherited(boolean inherited)
void
setParent(org.revapi.java.spi.JavaElement parent)
String
toString()
-
Methods inherited from class org.revapi.java.model.AbstractJavaElement
getTypeEnvironment, newReference, setArchive
-
Methods inherited from class org.revapi.base.BaseElement
castThis, getArchive, getChildren, getReferencedElements, getReferencingElements, iterateOverChildren, newChildrenInstance, searchChildren, searchChildren
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
representation
protected final T extends TypeMirror representation
-
-
Method Detail
-
getParent
@Nullable public org.revapi.java.spi.JavaModelElement getParent()
-
setParent
public void setParent(@Nullable org.revapi.java.spi.JavaElement parent)
-
getApi
@Nonnull public org.revapi.API getApi()
-
compareTo
public int compareTo(@Nonnull org.revapi.java.spi.JavaElement o)
- Specified by:
compareTo
in interfaceComparable<E extends Element>
-
getDeclaringElement
public E getDeclaringElement()
- Specified by:
getDeclaringElement
in interfaceorg.revapi.java.spi.JavaModelElement
-
getModelRepresentation
public T getModelRepresentation()
- Specified by:
getModelRepresentation
in interfaceorg.revapi.java.spi.JavaModelElement
-
isInherited
public boolean isInherited()
- Specified by:
isInherited
in interfaceorg.revapi.java.spi.JavaModelElement
-
setInherited
public void setInherited(boolean inherited)
-
createFullHumanReadableString
protected String createFullHumanReadableString()
-
clone
public JavaElementBase<E,T> clone()
- Overrides:
clone
in classorg.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()
-
-