Class PythonScriptElement
java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
io.micronaut.python.processing.visitor.PythonScriptElement
- All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, ClassElement, Element, TypedElement
public final class PythonScriptElement
extends AbstractAnnotationElement
implements ClassElement, ElementProvider
Represents a Python script as a Micronaut ClassElement.
Scripts are modeled as singleton classes where module-level attributes
become injectable fields and module-level functions become methods.
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionPythonScriptElement(ScriptDef scriptDef, PythonProcessingEnvironment environment) -
Method Summary
Modifier and TypeMethodDescriptionprotected PythonScriptElementcopyThis()protected voidcopyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element) @Nullable Elementelement()boolean@NonNull ClassElementDereference a class element denoting an array type by converting it to its element type.@NonNull AnnotationMetadataSupplies the metadata.protected MutableAnnotationMetadataDelegate<?> Get annotation metadata to add or remove annotations.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.getEnclosedElements(ElementQuery<T> query) Return the elements that match the given query.getName()Returns the native underlying type.Find and return a single primary constructor.Returns the super type of this element or empty if the element has no super type.Returns the synthetic bean properties.Returns the type annotations.inthashCode()booleanbooleanisAssignable(String type) Tests whether one type is assignable to another.booleanbooleanisPublic()protected final io.micronaut.python.processing.visitor.AbstractPythonElementmakeCopy()@NonNull ClassElementtoArray()Convert the class element to an element for the same type, but representing an array.toString()withAnnotationMetadata(AnnotationMetadata annotationMetadata) Copies this element and overrides its annotations.Methods inherited from class AbstractAnnotationElement
annotate, annotate, annotate, annotate, annotate, getElementAnnotationMetadata, getElementAnnotationMetadataFactory, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotypeMethods 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 ClassElement
addAssociatedBean, findDefaultStaticCreator, findField, findMethod, findStaticCreator, foldBoundGenericTypes, getAccessibleConstructors, getAccessibleStaticCreators, getAllTypeArguments, getBoundGenericTypes, getCanonicalName, getDeclaredGenericPlaceholders, getDefaultConstructor, getEnclosedElement, getEnclosingType, getFields, getFirstTypeArgument, getMethods, getOptionalValueType, getPackage, getPackageName, getPermittedSubclasses, getRawClassElement, getSimpleName, getType, getTypeArguments, getTypeArguments, getTypeArguments, hasUnresolvedTypes, 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, getDocumentation, getModifiers, getName, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotypeMethods inherited from interface TypedElement
getArrayDimensions, getGenericType, isArray, isPrimitive, isVoid
-
Field Details
-
typeAnnotationsKey
-
-
Constructor Details
-
PythonScriptElement
-
-
Method Details
-
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
-
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
-
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
-
copyThis
- Returns:
- copy of this element
-
toString
-
isAssignable
Description copied from interface:ClassElementTests whether one type is assignable to another.- Specified by:
isAssignablein interfaceClassElement- Parameters:
type- The type to check- Returns:
trueif and only if this type is assignable to the second
-
getPrimaryConstructor
Description copied from interface:ClassElementFind and return a single primary constructor. If more than constructor candidate exists, then return empty unless a constructor is found that is annotated with eitherCreatororAnnotationUtil.INJECT.- Specified by:
getPrimaryConstructorin interfaceClassElement- Returns:
- The primary constructor if one is present
-
getSuperType
Description copied from interface:ClassElementReturns the super type of this element or empty if the element has no super type.- Specified by:
getSuperTypein interfaceClassElement- Returns:
- An optional of the super type
-
getInterfaces
- Specified by:
getInterfacesin interfaceClassElement- Returns:
- The interfaces implemented by this class element
-
toArray
Description copied from interface:ClassElementConvert the class element to an element for the same type, but representing an array. Do not mutate the existing instance. Create a new instance instead.- Specified by:
toArrayin interfaceClassElement- Returns:
- A new class element
-
fromArray
Description copied from interface:ClassElementDereference a class element denoting an array type by converting it to its element type. Do not mutate the existing instance. Create a new instance instead.- Specified by:
fromArrayin interfaceClassElement- Returns:
- A new class element
-
isAbstract
public boolean isAbstract()- Specified by:
isAbstractin interfaceElement- Returns:
- True if the element is abstract.
-
element
- Specified by:
elementin interfaceElementProvider- Returns:
- The native element.
-
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
-
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
-
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() -
getName
-
isProtected
public boolean isProtected()- Specified by:
isProtectedin interfaceElement- Returns:
- True if the element is protected.
-
isPublic
-
equals
-
hashCode
-