Interface Element
- All Superinterfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, MutableAnnotationMetadataDelegate<Element>, Named
- All Known Subinterfaces:
AnnotationElement, ArrayableClassElement, BeanConstructorElement, BeanElement, BeanElementBuilder, BeanFieldElement, BeanMethodElement, BeanParameterElement, ClassElement, ConfigurableElement, ConstructorElement, EnumConstantElement, EnumElement, FieldElement, GenericElement, GenericPlaceholderElement, InjectableElement, KotlinParameterElement, MemberElement, MethodElement, PackageElement, ParameterElement, PropertyElement, TypedElement, WildcardElement
- All Known Implementing Classes:
AbstractAnnotationElement, AbstractBeanDefinitionBuilder, AbstractGroovyElement, AbstractJavaElement, AbstractJavaMemberElement, AbstractTypeAwareJavaElement, BeanDefinitionWriter, GroovyClassElement, GroovyConstructorElement, GroovyEnumConstantElement, GroovyFieldElement, GroovyMethodElement, GroovyPackageElement, GroovyParameterElement, JavaClassElement, JavaMethodElement, JavaPackageElement, PrimitiveElement
public interface Element
extends MutableAnnotationMetadataDelegate<Element>, AnnotatedElement, Described
Stores data about a compile time element. The underlying object can be a class, field, or method.
- Since:
- 1.0
- Author:
- James Kleeh, graemerocher
-
Field Summary
FieldsFields inherited from interface AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface AnnotationSource
EMPTYFields inherited from interface MutableAnnotationMetadataDelegate
EMPTY -
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends Annotation>
Elementannotate(AnnotationValue<T> annotationValue) Annotate this element with the given annotation type.default <T extends Annotation>
ElementAnnotate this element with the given annotation type.default <T extends Annotation>
Elementannotate(Class<T> annotationType, Consumer<AnnotationValueBuilder<T>> consumer) Annotate this element with the given annotation type.default ElementAnnotate this element with the given annotation type.default <T extends Annotation>
Elementannotate(String annotationType, Consumer<AnnotationValueBuilder<T>> consumer) Annotate this element with the given annotation type.default StringA description that describes this object.default StringgetDescription(boolean simple) Allows returning a more simple description if requested.getDocumentation(boolean parseContent) default Set<ElementModifier> getName()Returns the native underlying type.default StringThe simple name of the element.default booleandefault booleanisFinal()default booleandefault booleanbooleanbooleanisPublic()default booleanisStatic()default booleanChecks if the current element is synthetic - not user defined but created by the compiler.default <T extends Annotation>
ElementremoveAnnotation(Class<T> annotationType) default ElementremoveAnnotation(String annotationType) Removes an annotation of the given type from the element.default <T extends Annotation>
ElementremoveAnnotationIf(Predicate<AnnotationValue<T>> predicate) Removes all annotations that pass the given predicate.default <T extends Annotation>
ElementremoveStereotype(Class<T> annotationType) Removes a stereotype annotation of the given type from the element.default ElementremoveStereotype(String annotationType) Removes a stereotype of the given name from the element.default ElementwithAnnotationMetadata(AnnotationMetadata annotationMetadata) Copies this element and overrides its annotations.Methods inherited from interface AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullableMethods inherited from interface AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresentMethods inherited from interface AnnotationMetadataDelegate
booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, 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, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, 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, synthesizeDeclaredAnnotationsByTypeMethods inherited from interface AnnotationMetadataProvider
getAnnotationMetadata
-
Field Details
-
EMPTY_ELEMENT_ARRAY
-
-
Method Details
-
getName
-
isPackagePrivate
default boolean isPackagePrivate()- Returns:
- True if the element is package private.
- Since:
- 2.3.0
-
isSynthetic
default boolean isSynthetic()Checks if the current element is synthetic - not user defined but created by the compiler.- Returns:
- True if the element is synthetic.
- Since:
- 4.0.0
-
isProtected
boolean isProtected()- Returns:
- True if the element is protected.
-
isPublic
boolean isPublic()- Returns:
- True if the element is public.
-
getNativeType
Object getNativeType()Returns the native underlying type. This API is extended by all inject language implementations. The object returned by this method will be the language native type the information is being retrieved from.- Returns:
- The native type
-
getModifiers
- Returns:
- The
ElementModifiertypes for this class element - Since:
- 3.0.0
-
getSimpleName
The simple name of the element. For a class this will be the name without the package.- Returns:
- The simple name
-
isAbstract
default boolean isAbstract()- Returns:
- True if the element is abstract.
-
isStatic
default boolean isStatic()- Returns:
- True if the element is static.
-
getDocumentation
-
getDocumentation
-
isPrivate
default boolean isPrivate()- Returns:
- True if the element is private.
-
isFinal
default boolean isFinal()- Returns:
- True if the element is final.
-
getDescription
Description copied from interface:DescribedA description that describes this object.- Specified by:
getDescriptionin interfaceDescribed- Returns:
- The description
-
getDescription
Description copied from interface:DescribedAllows returning a more simple description if requested.- Specified by:
getDescriptionin interfaceDescribed- Parameters:
simple- True if a simple description is required- Returns:
- The simple description
-
withAnnotationMetadata
Copies this element and overrides its annotations.- Parameters:
annotationMetadata- The annotation metadata- Returns:
- A new element
- Since:
- 4.0.0
-
annotate
default <T extends Annotation> Element annotate(String annotationType, Consumer<AnnotationValueBuilder<T>> consumer) Description copied from interface:MutableAnnotationMetadataDelegateAnnotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotatein interfaceMutableAnnotationMetadataDelegate<Element>- Type Parameters:
T- The annotation generic type- Parameters:
annotationType- The annotation typeconsumer- A function that receives theAnnotationValueBuilder- Returns:
- This element
-
removeAnnotation
Description copied from interface:MutableAnnotationMetadataDelegateRemoves an annotation of the given type from the 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.
- Specified by:
removeAnnotationin interfaceMutableAnnotationMetadataDelegate<Element>- Parameters:
annotationType- The annotation type- Returns:
- This element
-
removeAnnotation
- Specified by:
removeAnnotationin interfaceMutableAnnotationMetadataDelegate<Element>- Type Parameters:
T- The annotation generic type- Parameters:
annotationType- The annotation type- Returns:
- This element
- See Also:
-
removeAnnotationIf
Description copied from interface:MutableAnnotationMetadataDelegateRemoves all annotations that pass the given predicate.- Specified by:
removeAnnotationIfin interfaceMutableAnnotationMetadataDelegate<Element>- Type Parameters:
T- The annotation generic type- Parameters:
predicate- The predicate- Returns:
- This element
-
removeStereotype
Description copied from interface:MutableAnnotationMetadataDelegateRemoves a stereotype of the given name from the element.- Specified by:
removeStereotypein interfaceMutableAnnotationMetadataDelegate<Element>- Parameters:
annotationType- The annotation type- Returns:
- This element
-
removeStereotype
Description copied from interface:MutableAnnotationMetadataDelegateRemoves a stereotype annotation of the given type from the element.- Specified by:
removeStereotypein interfaceMutableAnnotationMetadataDelegate<Element>- Type Parameters:
T- The annotation generic type- Parameters:
annotationType- The annotation type- Returns:
- This element
-
annotate
Description copied from interface:MutableAnnotationMetadataDelegateAnnotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotatein interfaceMutableAnnotationMetadataDelegate<Element>- Parameters:
annotationType- The annotation type- Returns:
- This element
-
annotate
default <T extends Annotation> Element annotate(Class<T> annotationType, Consumer<AnnotationValueBuilder<T>> consumer) Description copied from interface:MutableAnnotationMetadataDelegateAnnotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotatein interfaceMutableAnnotationMetadataDelegate<Element>- Type Parameters:
T- The annotation generic type- Parameters:
annotationType- The annotation typeconsumer- A function that receives theAnnotationValueBuilder- Returns:
- This element
-
annotate
Description copied from interface:MutableAnnotationMetadataDelegateAnnotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotatein interfaceMutableAnnotationMetadataDelegate<Element>- Type Parameters:
T- The annotation generic type- Parameters:
annotationType- The annotation type- Returns:
- This element
-
annotate
Description copied from interface:MutableAnnotationMetadataDelegateAnnotate this element with the given annotation type. If the annotation is already present then any values populated by the builder will be merged/overridden with the existing values.- Specified by:
annotatein interfaceMutableAnnotationMetadataDelegate<Element>- Type Parameters:
T- The annotation generic type- Parameters:
annotationValue- The annotation type- Returns:
- This element
-