Package io.micronaut.inject.ast
Interface MemberElement
- All Superinterfaces:
AnnotatedElement,AnnotationMetadata,AnnotationMetadataDelegate,AnnotationMetadataProvider,AnnotationSource,Described,Element,MutableAnnotationMetadataDelegate<Element>,Named
- All Known Subinterfaces:
BeanConstructorElement,BeanFieldElement,BeanMethodElement,ConstructorElement,EnumConstantElement,FieldElement,MethodElement,PropertyElement
- All Known Implementing Classes:
GroovyConstructorElement,GroovyEnumConstantElement,GroovyFieldElement,GroovyMethodElement,JavaMethodElement
A member element is an element that is contained within a
ClassElement.
The getDeclaringType() method returns the class that declares the element.- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTYFields inherited from interface io.micronaut.inject.ast.Element
EMPTY_ELEMENT_ARRAYFields inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate
EMPTY -
Method Summary
Modifier and TypeMethodDescriptiondefault Set<ElementModifier>default ClassElementThe owing type is the type that owns this element.default booleanhides(@NonNull MemberElement hidden) Checks if this member element hides another.default booleanReturns whether this member element can be invoked or retrieved at runtime.default booleanisAccessible(@NonNull ClassElement callingType) Returns whether this member element can be invoked or retrieved at runtime.default booleanisAccessible(@NonNull ClassElement callingType, boolean allowReflection) Returns whether this member element can be invoked or retrieved at runtime.default booleanReturns whether this member element will require reflection to invoke or retrieve at runtime.default booleanisReflectionRequired(@NonNull ClassElement callingType) Returns whether this member element will require reflection to invoke or retrieve at runtime.default MemberElementwithAnnotationMetadata(AnnotationMetadata annotationMetadata) Copies this element and overrides its annotations.Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullableMethods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresentMethods inherited from interface io.micronaut.core.annotation.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 io.micronaut.core.annotation.AnnotationMetadataProvider
getAnnotationMetadataMethods inherited from interface io.micronaut.inject.ast.Element
annotate, annotate, annotate, annotate, annotate, getDescription, getDescription, getDocumentation, getName, getNativeType, getSimpleName, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype
-
Method Details
-
getDeclaringType
ClassElement getDeclaringType()- Returns:
- The declaring type of the element.
-
getOwningType
The owing type is the type that owns this element. This can differ fromgetDeclaringType()in the case of inheritance since this method will return the subclass that owners the inherited member, whilstgetDeclaringType()will return the super class that declares the type.- Returns:
- The owning type.
-
getModifiers
- Specified by:
getModifiersin interfaceElement- Returns:
- The
ElementModifiertypes for this class element - Since:
- 3.0.0
-
isReflectionRequired
default boolean isReflectionRequired()Returns whether this member element will require reflection to invoke or retrieve at runtime.This method uses
getOwningType()as the calling type for this method.- Returns:
- Will return
trueif reflection is required. - Since:
- 3.4.0
-
isReflectionRequired
Returns whether this member element will require reflection to invoke or retrieve at runtime.- Parameters:
callingType- The calling type- Returns:
- Will return
trueif reflection is required. - Since:
- 3.4.0
-
isAccessible
default boolean isAccessible()Returns whether this member element can be invoked or retrieved at runtime. It can be accessible by a simple invocation or a reflection invocation.This method uses
isReflectionRequired()with a checks if the reflection access is allowed. By checking forReflectiveAccessannotation.- Returns:
- Will return
trueif is accessible. - Since:
- 3.7.0
-
isAccessible
@NextMajorVersion("The ReflectiveAccess should not be checked here and accessibility should fail if ReflectiveAccess is not present") default boolean isAccessible(@NonNull @NonNull ClassElement callingType, boolean allowReflection) Returns whether this member element can be invoked or retrieved at runtime. It can be accessible by a simple invocationThis method uses
isReflectionRequired()with a checks if the reflection access is allowed. By checking forReflectiveAccessannotation.- Parameters:
callingType- The calling typeallowReflection- If reflection invocation can be used- Returns:
- Will return
trueif is accessible. - Since:
- 4.3.0
-
isAccessible
Returns whether this member element can be invoked or retrieved at runtime. It can be accessible by a simple invocation or a reflection invocation.This method uses
isReflectionRequired()with a checks if the reflection access is allowed. By checking forReflectiveAccessannotation.- Parameters:
callingType- The calling type- Returns:
- Will return
trueif is accessible. - Since:
- 3.7.0
-
withAnnotationMetadata
Description copied from interface:ElementCopies this element and overrides its annotations.- Specified by:
withAnnotationMetadatain interfaceElement- Parameters:
annotationMetadata- The annotation metadata- Returns:
- A new element
-
hides
Checks if this member element hides another.- Parameters:
hidden- The possibly hidden element- Returns:
- true if this member element hides passed field element
- Since:
- 4.0.0
-