public abstract class AbstractJavaElement extends java.lang.Object implements Element, AnnotationMetadataDelegate
EMPTY_ELEMENT_ARRAY
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER
EMPTY
Modifier and Type | Method and Description |
---|---|
<T extends java.lang.annotation.Annotation> |
annotate(AnnotationValue<T> annotationValue)
Annotate this element with the given annotation type.
|
<T extends java.lang.annotation.Annotation> |
annotate(java.lang.String annotationType,
java.util.function.Consumer<AnnotationValueBuilder<T>> consumer)
Annotate this element with the given annotation type.
|
boolean |
equals(java.lang.Object o) |
AnnotationMetadata |
getAnnotationMetadata()
Supplies the metadata.
|
java.util.Set<ElementModifier> |
getModifiers() |
java.lang.String |
getName() |
java.lang.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(javax.lang.model.type.TypeMirror returnType,
JavaVisitorContext visitorContext)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
mirrorToClassElement(javax.lang.model.type.TypeMirror returnType,
JavaVisitorContext visitorContext,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror>> genericsInfo)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
mirrorToClassElement(javax.lang.model.type.TypeMirror returnType,
JavaVisitorContext visitorContext,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror>> genericsInfo,
boolean includeTypeAnnotations)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
mirrorToClassElement(javax.lang.model.type.TypeMirror returnType,
JavaVisitorContext visitorContext,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror>> genericsInfo,
boolean includeTypeAnnotations,
boolean isTypeVariable)
Obtain the ClassElement for the given mirror.
|
protected ClassElement |
parameterizedClassElement(javax.lang.model.type.TypeMirror typeMirror,
JavaVisitorContext visitorContext,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror>> declaredGenericInfo)
Returns a class element with aligned generic information.
|
Element |
removeAnnotation(java.lang.String annotationType)
Removes an annotation of the given type from the element.
|
<T extends java.lang.annotation.Annotation> |
removeAnnotationIf(java.util.function.Predicate<AnnotationValue<T>> predicate)
Removes all annotations that pass the given predicate.
|
Element |
removeStereotype(java.lang.String annotationType)
Removes a stereotype of the given name from the element.
|
java.lang.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
getValues, hasDeclaredStereotype, isAnnotationPresent, isDeclaredAnnotationPresent
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
@NonNull public <T extends java.lang.annotation.Annotation> Element annotate(@NonNull java.lang.String annotationType, @NonNull java.util.function.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 java.lang.annotation.Annotation> Element annotate(AnnotationValue<T> annotationValue)
Element
public Element removeAnnotation(@NonNull java.lang.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 java.lang.annotation.Annotation> Element removeAnnotationIf(@NonNull java.util.function.Predicate<AnnotationValue<T>> predicate)
Element
removeAnnotationIf
in interface Element
T
- The annotation generic typepredicate
- The predicatepublic Element removeStereotype(@NonNull java.lang.String annotationType)
Element
removeStereotype
in interface Element
annotationType
- The annotation typepublic boolean isPackagePrivate()
isPackagePrivate
in interface Element
public java.lang.String getName()
public java.util.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 java.lang.Object getNativeType()
Element
getNativeType
in interface Element
public AnnotationMetadata getAnnotationMetadata()
AnnotationMetadataProvider
AnnotationMetadata.EMPTY_METADATA
.getAnnotationMetadata
in interface AnnotationMetadataProvider
AnnotationMetadata
public java.lang.String toString()
toString
in class java.lang.Object
@NonNull protected ClassElement parameterizedClassElement(javax.lang.model.type.TypeMirror typeMirror, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror>> declaredGenericInfo)
typeMirror
- The type mirrorvisitorContext
- The visitor contextdeclaredGenericInfo
- The declared generic info@NonNull protected ClassElement mirrorToClassElement(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext)
returnType
- The return typevisitorContext
- The visitor context@NonNull protected ClassElement mirrorToClassElement(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.TypeMirror>> genericsInfo)
returnType
- The return typevisitorContext
- The visitor contextgenericsInfo
- The generic information.@NonNull protected ClassElement mirrorToClassElement(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.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(javax.lang.model.type.TypeMirror returnType, JavaVisitorContext visitorContext, java.util.Map<java.lang.String,java.util.Map<java.lang.String,javax.lang.model.type.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 variablepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object