Class PythonPropertyGetterMethodElement
java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
io.micronaut.python.processing.visitor.PythonPropertyGetterMethodElement
- All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, Element, MemberElement, MethodElement
public final class PythonPropertyGetterMethodElement
extends AbstractAnnotationElement
implements MethodElement, ElementProvider
A synthetic getter method element for Python properties.
This allows synthetic property getters to support annotation mutation,
unlike MethodElement.of() which creates immutable elements.
- Since:
- 5.2.0
- Author:
- Micronaut Team
-
Field Summary
Fields inherited from class AbstractAnnotationElement
elementAnnotationMetadataFactory, presetAnnotationMetadataFields inherited from interface AnnotationMetadata
CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBERFields inherited from interface AnnotationSource
EMPTYFields inherited from interface Element
EMPTY_ELEMENT_ARRAYFields inherited from interface MutableAnnotationMetadataDelegate
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionPythonPropertyGetterMethodElement(PythonPropertyElement propertyElement, PythonProcessingEnvironment environment, ClassElement declaringType, ClassElement owningType, ElementAnnotationMetadataFactory metadataFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micronaut.python.processing.visitor.AbstractPythonElementcopyThis()protected voidcopyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element) element()booleanSupplies the metadata.protected MutableAnnotationMetadataDelegate<?> Get annotation metadata to add or remove annotations.getDocumentation(boolean parseContent) protected ElementAnnotationMetadataThe generic return type of the method.Returns the method annotations.getName()Returns the native underlying type.The owning type is the type that owns this element.inthashCode()booleanbooleanbooleanisPublic()booleanReturns whether this member element will require reflection to invoke or retrieve at runtime.booleanisReflectionRequired(ClassElement callingType) Returns whether this member element will require reflection to invoke or retrieve at runtime.booleanChecks if the current element is synthetic - not user defined but created by the compiler.protected final io.micronaut.python.processing.visitor.AbstractPythonElementmakeCopy()withAnnotationMetadata(AnnotationMetadata annotationMetadata) Copies this element and overrides its annotations.withParameters(ParameterElement... newParameters) Takes this method element and transforms into a new method element with the given parameters.Methods inherited from class AbstractAnnotationElement
annotate, annotate, annotate, annotate, annotate, getElementAnnotationMetadataFactory, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotypeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AnnotatedElement
isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullableMethods inherited from interface AnnotationMetadata
enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, 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, hasEvaluatedExpressions, 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 Element
annotate, annotate, annotate, annotate, annotate, getDescription, getDocumentation, getSimpleName, isAbstract, isFinal, isPackagePrivate, isStatic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotypeMethods inherited from interface MemberElement
getModifiers, isAccessible, isAccessible, isAccessibleMethods inherited from interface MethodElement
addAssociatedBean, findParameterIndex, getDeclaredTypeArguments, getDeclaredTypeVariables, getDescription, getOverriddenMethods, getParameter, getReceiverType, getSuspendParameters, getThrownTypes, getTypeArguments, hasParameters, hides, hides, isDefault, isSubSignature, isSuspend, isVarArgs, overrides, withNewOwningType, withNewParameters
-
Constructor Details
-
PythonPropertyGetterMethodElement
public PythonPropertyGetterMethodElement(PythonPropertyElement propertyElement, PythonProcessingEnvironment environment, ClassElement declaringType, ClassElement owningType, ElementAnnotationMetadataFactory metadataFactory)
-
-
Method Details
-
getMethodAnnotationMetadata
Description copied from interface:MethodElementReturns the method annotations. The method will only return annotations defined on a method or inherited from the super methods, whileAnnotationMetadataProvider.getAnnotationMetadata()for a method combines the class and the method annotations. NOTE: For a constructorAnnotationMetadataProvider.getAnnotationMetadata()will not combine the class annotations.- Specified by:
getMethodAnnotationMetadatain interfaceMethodElement- Returns:
- The method annotation metadata
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Overrides:
getAnnotationMetadatain classAbstractAnnotationElement- Returns:
- The
AnnotationMetadata
-
getElementAnnotationMetadata
- Overrides:
getElementAnnotationMetadatain classAbstractAnnotationElement- Returns:
- The element's annotation metadata
-
getAnnotationMetadataToWrite
Description copied from class:AbstractAnnotationElementGet annotation metadata to add or remove annotations.- Overrides:
getAnnotationMetadataToWritein classAbstractAnnotationElement- Returns:
- The annotation metadata to write
-
isReflectionRequired
public boolean isReflectionRequired()Description copied from interface:MemberElementReturns whether this member element will require reflection to invoke or retrieve at runtime.This method uses
MemberElement.getOwningType()as the calling type for this method.- Specified by:
isReflectionRequiredin interfaceMemberElement- Returns:
- Will return
trueif reflection is required.
-
isReflectionRequired
Description copied from interface:MemberElementReturns whether this member element will require reflection to invoke or retrieve at runtime.- Specified by:
isReflectionRequiredin interfaceMemberElement- Parameters:
callingType- The calling type- Returns:
- Will return
trueif reflection is required.
-
getNativeType
Description copied from interface:ElementReturns 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.- Specified by:
getNativeTypein interfaceElement- Returns:
- The native type
-
getReturnType
- Specified by:
getReturnTypein interfaceMethodElement- Returns:
- The return type of the method
-
getGenericReturnType
Description copied from interface:MethodElementThe generic return type of the method.- Specified by:
getGenericReturnTypein interfaceMethodElement- Returns:
- The return type of the method
-
getParameters
- Specified by:
getParametersin interfaceMethodElement- Returns:
- The method parameters
-
getName
-
withParameters
Description copied from interface:MethodElementTakes this method element and transforms into a new method element with the given parameters.- Specified by:
withParametersin interfaceMethodElement- Parameters:
newParameters- The new parameters- Returns:
- A new method element
-
isPublic
-
isPrivate
-
isProtected
public boolean isProtected()- Specified by:
isProtectedin interfaceElement- Returns:
- True if the element is protected.
-
isSynthetic
public boolean isSynthetic()Description copied from interface:ElementChecks if the current element is synthetic - not user defined but created by the compiler.- Specified by:
isSyntheticin interfaceElement- Returns:
- True if the element is synthetic.
-
getDeclaringType
- Specified by:
getDeclaringTypein interfaceMemberElement- Returns:
- The declaring type of the element.
-
getOwningType
Description copied from interface:MemberElementThe owning type is the type that owns this element. This can differ fromMemberElement.getDeclaringType()in the case of inheritance since this method will return the subclass that owners the inherited member, whilstMemberElement.getDeclaringType()will return the super class that declares the type.- Specified by:
getOwningTypein interfaceMemberElement- Returns:
- The owning type.
-
getDocumentation
- Specified by:
getDocumentationin interfaceElement- Parameters:
parseContent- True if the content should be parsed to extract documentation- Returns:
- The documentation, if any.
-
equals
-
hashCode
public int hashCode() -
copyThis
protected io.micronaut.python.processing.visitor.AbstractPythonElement copyThis()- Returns:
- copy of this element
-
withAnnotationMetadata
Description copied from interface:ElementCopies this element and overrides its annotations.- Specified by:
withAnnotationMetadatain interfaceElement- Specified by:
withAnnotationMetadatain interfaceMemberElement- Specified by:
withAnnotationMetadatain interfaceMethodElement- Parameters:
annotationMetadata- The annotation metadata- Returns:
- A new element
-
element
- Specified by:
elementin interfaceElementProvider- Returns:
- The native element.
-
copyValues
protected void copyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element) - Parameters:
element- the values to be copied to
-
makeCopy
protected final io.micronaut.python.processing.visitor.AbstractPythonElement makeCopy()
-