public abstract class AbstractJavaElement extends Object implements Element, AnnotationMetadataDelegate
EMPTY_ELEMENT_ARRAY
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Modifier and Type | Method and Description |
---|---|
<T extends Annotation> |
annotate(AnnotationValue<T> annotationValue)
Annotate this element with the given annotation type.
|
<T extends Annotation> |
annotate(String annotationType,
Consumer<AnnotationValueBuilder<T>> consumer)
Annotate this element with the given annotation type.
|
boolean |
equals(Object o) |
AnnotationMetadata |
getAnnotationMetadata()
Supplies the metadata.
|
Set<ElementModifier> |
getModifiers() |
String |
getName() |
Object |
getNativeType()
Returns the native underlying type.
|
int |
hashCode() |
boolean |
isAbstract() |
boolean |
isFinal() |
boolean |
isPackagePrivate() |
boolean |
isPrivate() |
boolean |
isProtected() |
boolean |
isPublic() |
boolean |
isStatic() |
protected ClassElement |
mirrorToClassElement(TypeMirror returnType,
JavaVisitorContext visitorContext)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
mirrorToClassElement(TypeMirror returnType,
JavaVisitorContext visitorContext,
Map<String,Map<String,TypeMirror>> genericsInfo)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
mirrorToClassElement(TypeMirror returnType,
JavaVisitorContext visitorContext,
Map<String,Map<String,TypeMirror>> genericsInfo,
boolean includeTypeAnnotations)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
mirrorToClassElement(TypeMirror returnType,
JavaVisitorContext visitorContext,
Map<String,Map<String,TypeMirror>> genericsInfo,
boolean includeTypeAnnotations,
boolean isTypeVariable)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
parameterizedClassElement(TypeMirror typeMirror,
JavaVisitorContext visitorContext,
Map<String,Map<String,TypeMirror>> declaredGenericInfo)
Returns a class element with aligned generic information.
|
Element |
removeAnnotation(String annotationType)
Removes an annotation of the given type from the element.
|
<T extends Annotation> |
removeAnnotationIf(Predicate<AnnotationValue<T>> predicate)
Removes all annotations that pass the given predicate.
|
Element |
removeStereotype(String annotationType)
Removes a stereotype of the given name from the element.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
annotate, annotate, annotate, getDescription, getDescription, getDocumentation, getSimpleName, removeAnnotation, removeStereotype
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
getAnnotationValuesByName, getDeclaredAnnotationValuesByName, getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
@NonNull public <T extends Annotation> Element annotate(@NonNull String annotationType, @NonNull Consumer<AnnotationValueBuilder<T>> consumer)
Element
annotate
in interface Element
T
- The annotation generic typeannotationType
- The annotation typeconsumer
- A function that receives the AnnotationValueBuilder
public <T extends Annotation> Element annotate(AnnotationValue<T> annotationValue)
Element
public Element removeAnnotation(@NonNull String annotationType)
Element
If the annotation features any stereotypes these will also be removed unless there are other annotations that reference the stereotype to be removed.
In the case of repeatable annotations this method will remove all repeated annotations, effectively clearing out all declared repeated annotations of the given type.
removeAnnotation
in interface Element
annotationType
- The annotation typepublic <T extends Annotation> Element removeAnnotationIf(@NonNull Predicate<AnnotationValue<T>> predicate)
Element
removeAnnotationIf
in interface Element
T
- The annotation generic typepredicate
- The predicatepublic Element removeStereotype(@NonNull String annotationType)
Element
removeStereotype
in interface Element
annotationType
- The annotation typepublic boolean isPackagePrivate()
isPackagePrivate
in interface Element
public String getName()
public Set<ElementModifier> getModifiers()
getModifiers
in interface Element
ElementModifier
types for this class elementpublic boolean isAbstract()
isAbstract
in interface Element
public boolean isStatic()
public boolean isPublic()
public boolean isPrivate()
public boolean isFinal()
public boolean isProtected()
isProtected
in interface Element
public Object getNativeType()
Element
getNativeType
in interface Element
public AnnotationMetadata getAnnotationMetadata()
AnnotationMetadataProvider
AnnotationMetadata.EMPTY_METADATA
.getAnnotationMetadata
in interface AnnotationMetadataProvider
AnnotationMetadata
@NonNull protected ClassElement parameterizedClassElement(TypeMirror typeMirror, JavaVisitorContext visitorContext, Map<String,Map<String,TypeMirror>> declaredGenericInfo)
typeMirror
- The type mirrorvisitorContext
- The visitor contextdeclaredGenericInfo
- The declared generic info@NonNull protected ClassElement mirrorToClassElement(TypeMirror returnType, JavaVisitorContext visitorContext)
returnType
- The return typevisitorContext
- The visitor context@NonNull protected ClassElement mirrorToClassElement(TypeMirror returnType, JavaVisitorContext visitorContext, Map<String,Map<String,TypeMirror>> genericsInfo)
returnType
- The return typevisitorContext
- The visitor contextgenericsInfo
- The generic information.@NonNull protected ClassElement mirrorToClassElement(TypeMirror returnType, JavaVisitorContext visitorContext, Map<String,Map<String,TypeMirror>> genericsInfo, boolean includeTypeAnnotations)
returnType
- The return typevisitorContext
- The visitor contextgenericsInfo
- The generic information.includeTypeAnnotations
- Whether to include type level annotations in the metadata for the element@NonNull protected ClassElement mirrorToClassElement(TypeMirror returnType, JavaVisitorContext visitorContext, Map<String,Map<String,TypeMirror>> genericsInfo, boolean includeTypeAnnotations, boolean isTypeVariable)
returnType
- The return typevisitorContext
- The visitor contextgenericsInfo
- The generic information.includeTypeAnnotations
- Whether to include type level annotations in the metadata for the elementisTypeVariable
- is the type a type variable