Class AbstractPythonClassElement
java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
io.micronaut.python.processing.visitor.AbstractPythonClassElement
- All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, ArrayableClassElement, ClassElement, Element, TypedElement
- Direct Known Subclasses:
PythonClassElement, PythonEnumElement, PythonGenericPlaceholderElement
public abstract sealed class AbstractPythonClassElement
extends AbstractAnnotationElement
implements ArrayableClassElement, ElementProvider
permits PythonClassElement, PythonEnumElement, PythonGenericPlaceholderElement
Base class element implementation shared by Python class-like elements.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final PythonProcessingEnvironmentstatic final Stringprotected ElementDefFields 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 ClassElement
ZERO_CLASS_ELEMENTSFields inherited from interface Element
EMPTY_ELEMENT_ARRAYFields inherited from interface MutableAnnotationMetadataDelegate
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPythonClassElement(ClassDef classDef, PythonProcessingEnvironment environment) protectedAbstractPythonClassElement(ClassDef classDef, PythonProcessingEnvironment environment, int arrayDimensions) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract io.micronaut.python.processing.visitor.AbstractPythonElementcopyThis()protected voidcopyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element) protected abstract ClassElementcreateWithArrayDimensions(int arrayDimensions) element()booleanprotected final voidexcludeIntrospectedProperties(String... propertyNames) protected final @Nullable ClassElementfindPythonClass(TypeRef typeRef) @NonNull AnnotationMetadataSupplies the metadata.protected MutableAnnotationMetadataDelegate<?> Get annotation metadata to add or remove annotations.intIf the type is an array, the number of dimensions.Returns the bean properties (getters and setters) for this class element.getBeanProperties(PropertyElementQuery propertyElementQuery) Returns the bean properties (getters and setters) for this class element based on custom configuration.getDocumentation(boolean parseContent) getEnclosedElements(ElementQuery<T> query) Return the elements that match the given query.Return all the fields of this class element.getName()Returns the native underlying type.The package name.Returns the synthetic bean properties.Returns the type annotations.final ElementDefinthashCode()booleanbooleanisArray()Is the type an array.booleanbooleanisPublic()protected final io.micronaut.python.processing.visitor.AbstractPythonElementmakeCopy()withAnnotationMetadata(AnnotationMetadata annotationMetadata) Copies this element and overrides its annotations.withArrayDimensions(int arrayDimensions) Convert the class element to an element for the same type, but with the given number of array dimensions.Methods inherited from class AbstractAnnotationElement
annotate, annotate, annotate, annotate, annotate, getElementAnnotationMetadata, 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 ArrayableClassElement
fromArray, toArrayMethods inherited from interface ClassElement
addAssociatedBean, findDefaultStaticCreator, findField, findMethod, findStaticCreator, foldBoundGenericTypes, getAccessibleConstructors, getAccessibleStaticCreators, getAllTypeArguments, getBoundGenericTypes, getCanonicalName, getDeclaredGenericPlaceholders, getDefaultConstructor, getEnclosedElement, getEnclosingType, getFirstTypeArgument, getMethods, getOptionalValueType, getPackage, getPermittedSubclasses, getPrimaryConstructor, getRawClassElement, getSimpleName, getSuperType, getType, getTypeArguments, getTypeArguments, getTypeArguments, hasUnresolvedTypes, isAssignable, isAssignable, isAssignable, isContainerType, isEnum, isGenericPlaceholder, isInner, isInterface, isIterable, isOptional, isProxy, isRawType, isRecord, isSealed, isTypeVariable, isWildcard, withBoundGenericTypes, withTypeArguments, withTypeArgumentsMethods inherited from interface Element
annotate, annotate, annotate, annotate, annotate, getDescription, getDescription, getDocumentation, getModifiers, getName, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotypeMethods inherited from interface TypedElement
getGenericType, isPrimitive, isVoid
-
Field Details
-
PYTHON_DEFAULT_PACKAGE
- See Also:
-
arrayDimensions
protected final int arrayDimensions -
environment
-
typeAnnotationsKey
-
-
Constructor Details
-
AbstractPythonClassElement
-
AbstractPythonClassElement
protected AbstractPythonClassElement(ClassDef classDef, PythonProcessingEnvironment environment, int arrayDimensions)
-
-
Method Details
-
copyValues
protected void copyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element) - Parameters:
element- the values to be copied to
-
getAnnotationMetadataToWrite
Description copied from class:AbstractAnnotationElementGet annotation metadata to add or remove annotations.- Overrides:
getAnnotationMetadataToWritein classAbstractAnnotationElement- Returns:
- The annotation metadata to write
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Overrides:
getAnnotationMetadatain classAbstractAnnotationElement- Returns:
- The
AnnotationMetadata
-
getTypeAnnotationMetadata
Description copied from interface:ClassElementReturns the type annotations. Added by: - The declaration of the type variableElementType.TYPE_PARAMETER- The use of the typeElementType.TYPE- Specified by:
getTypeAnnotationMetadatain interfaceClassElement- Returns:
- the type annotations
-
getTypeAnnotationsKey
-
findPythonClass
-
excludeIntrospectedProperties
-
isAbstract
public boolean isAbstract()- Specified by:
isAbstractin interfaceElement- Returns:
- True if the element is abstract.
-
getInterfaces
- Specified by:
getInterfacesin interfaceClassElement- Returns:
- The interfaces implemented by this class element
-
element
- Specified by:
elementin interfaceElementProvider- Returns:
- The native element.
-
withArrayDimensions
Description copied from interface:ArrayableClassElementConvert the class element to an element for the same type, but with the given number of array dimensions. Do not mutate the existing instance. Create a new instance instead.- Specified by:
withArrayDimensionsin interfaceArrayableClassElement- Parameters:
arrayDimensions- The number of array dimensions of the new class element- Returns:
- A new class element
-
createWithArrayDimensions
-
isArray
public boolean isArray()Description copied from interface:TypedElementIs the type an array.- Specified by:
isArrayin interfaceTypedElement- Returns:
- True if it is.
-
getArrayDimensions
public int getArrayDimensions()Description copied from interface:TypedElementIf the type is an array, the number of dimensions. String[] should return 1, String[][] should return 2- Specified by:
getArrayDimensionsin interfaceTypedElement- Returns:
- The number of dimensions
-
getEnclosedElements
Description copied from interface:ClassElementReturn the elements that match the given query.- Specified by:
getEnclosedElementsin interfaceClassElement- Type Parameters:
T- The element type- Parameters:
query- The query to use.- Returns:
- The fields
-
getFields
Description copied from interface:ClassElementReturn all the fields of this class element.- Specified by:
getFieldsin interfaceClassElement- Returns:
- The fields
-
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
-
getPackageName
Description copied from interface:ClassElementThe package name.- Specified by:
getPackageNamein interfaceClassElement- Returns:
- The package name
-
getDocumentation
- Specified by:
getDocumentationin interfaceElement- Parameters:
parseContent- True if the content should be parsed to extract documentation- Returns:
- The documentation, if any.
-
getSyntheticBeanProperties
Description copied from interface:ClassElementReturns the synthetic bean properties. The properties where one of the methods (getter or setter) is synthetic - not user defined but created by the compiler.- Specified by:
getSyntheticBeanPropertiesin interfaceClassElement- Returns:
- The bean properties for this class element
-
getBeanProperties
Description copied from interface:ClassElementReturns the bean properties (getters and setters) for this class element.- Specified by:
getBeanPropertiesin interfaceClassElement- Returns:
- The bean properties for this class element
-
getBeanProperties
Description copied from interface:ClassElementReturns the bean properties (getters and setters) for this class element based on custom configuration.- Specified by:
getBeanPropertiesin interfaceClassElement- Parameters:
propertyElementQuery- The configuration- Returns:
- The bean properties for this class element
-
copyThis
protected abstract 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 interfaceClassElement- Specified by:
withAnnotationMetadatain interfaceElement- Parameters:
annotationMetadata- The annotation metadata- Returns:
- A new element
-
makeCopy
protected final io.micronaut.python.processing.visitor.AbstractPythonElement makeCopy() -
getName
-
isProtected
public boolean isProtected()- Specified by:
isProtectedin interfaceElement- Returns:
- True if the element is protected.
-
isPublic
-
equals
-
hashCode
-