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_MEMBER
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
Fields inherited from interface io.micronaut.inject.ast.Element
EMPTY_ELEMENT_ARRAY
Fields inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate
EMPTY
-
Method Summary
Modifier and TypeMethodDescriptiondefault Set<ElementModifier>
default ClassElement
The owing type is the type that owns this element.default boolean
hides
(@NonNull MemberElement hidden) Checks if this member element hides another.default boolean
Returns whether this member element can be invoked or retrieved at runtime.default boolean
isAccessible
(@NonNull ClassElement callingType) Returns whether this member element can be invoked or retrieved at runtime.default boolean
isAccessible
(@NonNull ClassElement callingType, boolean allowReflection) Returns whether this member element can be invoked or retrieved at runtime.default boolean
Returns whether this member element will require reflection to invoke or retrieve at runtime.default boolean
isReflectionRequired
(@NonNull ClassElement callingType) Returns whether this member element will require reflection to invoke or retrieve at runtime.default MemberElement
withAnnotationMetadata
(AnnotationMetadata annotationMetadata) Copies this element and overrides its annotations.Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasEvaluatedExpressions, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent
Methods 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, synthesizeDeclaredAnnotationsByType
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
getAnnotationMetadata
Methods 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:
getModifiers
in interfaceElement
- Returns:
- The
ElementModifier
types 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
true
if 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
true
if 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 forReflectiveAccess
annotation.- Returns:
- Will return
true
if is accessible. - Since:
- 3.7.0
-
isAccessible
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 forReflectiveAccess
annotation.- Parameters:
callingType
- The calling typeallowReflection
- If reflection invocation can be used- Returns:
- Will return
true
if 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 forReflectiveAccess
annotation.- Parameters:
callingType
- The calling type- Returns:
- Will return
true
if is accessible. - Since:
- 3.7.0
-
withAnnotationMetadata
Description copied from interface:Element
Copies this element and overrides its annotations.- Specified by:
withAnnotationMetadata
in 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
-