Class PythonClassElement
java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
io.micronaut.python.processing.visitor.AbstractPythonClassElement
io.micronaut.python.processing.visitor.PythonClassElement
- All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, ArrayableClassElement, ClassElement, Element, TypedElement
Class element implementation for Python classes.
-
Field Summary
Fields inherited from class AbstractPythonClassElement
arrayDimensions, environment, PYTHON_DEFAULT_PACKAGE, typeAnnotationsKeyFields 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
ConstructorsConstructorDescriptionPythonClassElement(ClassDef classDef, PythonProcessingEnvironment environment) PythonClassElement(ClassDef classDef, PythonProcessingEnvironment environment, int arrayDimensions) -
Method Summary
Modifier and TypeMethodDescriptionThis method adds an associated bean using this class element as the originating element.protected PythonClassElementcopyThis()protected voidcopyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element) protected ClassElementcreateWithArrayDimensions(int arrayDimensions) booleanMap<String, Map<String, ClassElement>> Builds a map of all the type parameters for a class, its super classes and interfaces.@NonNull List<? extends GenericPlaceholderElement> The type arguments declared on the raw class.Find and return a single default constructor.Returns the enclosing type ifClassElement.isInner()returntrue.getName()Find and return a single primary constructor.Returns the super type of this element or empty if the element has no super type.@NonNull ClassElementgetType()inthashCode()booleanisAssignable(String type) Tests whether one type is assignable to another.booleanisInner()Is this type an inner class.booleanbooleanbooleanisPublic()booleanbooleanisStatic()protected final io.micronaut.python.processing.visitor.AbstractPythonElementmakeCopy()toString()withTypeArguments(Map<String, ClassElement> typeArguments) Copies this element and overrides its type arguments.Methods inherited from class AbstractPythonClassElement
element, excludeIntrospectedProperties, findPythonClass, getAnnotationMetadata, getAnnotationMetadataToWrite, getArrayDimensions, getBeanProperties, getBeanProperties, getDocumentation, getEnclosedElements, getFields, getNativeType, getPackageName, getSyntheticBeanProperties, getTypeAnnotationMetadata, getTypeAnnotationsKey, isAbstract, isArray, withAnnotationMetadata, withArrayDimensionsMethods 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 ArrayableClassElement
fromArray, toArrayMethods inherited from interface ClassElement
findDefaultStaticCreator, findField, findMethod, findStaticCreator, foldBoundGenericTypes, getAccessibleConstructors, getAccessibleStaticCreators, getBoundGenericTypes, getCanonicalName, getEnclosedElement, getFirstTypeArgument, getMethods, getOptionalValueType, getPackage, getPermittedSubclasses, getRawClassElement, getSimpleName, getTypeArguments, getTypeArguments, hasUnresolvedTypes, isAssignable, isAssignable, isContainerType, isEnum, isGenericPlaceholder, isIterable, isOptional, isProxy, isRawType, isRecord, isSealed, isTypeVariable, isWildcard, withBoundGenericTypes, withTypeArgumentsMethods inherited from interface Element
annotate, annotate, annotate, annotate, annotate, getDescription, getDescription, getDocumentation, getModifiers, getName, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotypeMethods inherited from interface TypedElement
getGenericType, isPrimitive, isVoid
-
Constructor Details
-
PythonClassElement
-
PythonClassElement
public PythonClassElement(ClassDef classDef, PythonProcessingEnvironment environment, int arrayDimensions)
-
-
Method Details
-
getType
- Returns:
- The type of the element
-
copyThis
- Specified by:
copyThisin classAbstractPythonClassElement- Returns:
- copy of this element
-
copyValues
protected void copyValues(io.micronaut.python.processing.visitor.AbstractPythonElement element) - Overrides:
copyValuesin classAbstractPythonClassElement- Parameters:
element- the values to be copied to
-
isPythonSource
public boolean isPythonSource() -
addAssociatedBean
Description copied from interface:ClassElementThis method adds an associated bean using this class element as the originating element.Note that this method can only be called on classes being directly compiled by Micronaut. If the ClassElement is loaded from pre-compiled code an
UnsupportedOperationExceptionwill be thrown.- Parameters:
type- The type of the bean- Returns:
- A bean builder
-
isInner
public boolean isInner()Description copied from interface:ClassElementIs this type an inner class.- Returns:
- True if it is an inner class
-
isStatic
public boolean isStatic()- Returns:
- True if the element is static.
-
getEnclosingType
Description copied from interface:ClassElementReturns the enclosing type ifClassElement.isInner()returntrue.- Returns:
- The enclosing type if any
-
createWithArrayDimensions
- Specified by:
createWithArrayDimensionsin classAbstractPythonClassElement
-
toString
-
getDefaultConstructor
Description copied from interface:ClassElementFind and return a single default constructor. A default constructor is one without arguments that is accessible.- Returns:
- The default constructor if one is present
-
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.- Returns:
- The primary constructor if one is present
-
isAssignable
Description copied from interface:ClassElementTests whether one type is assignable to another.- Parameters:
type- The type to check- Returns:
trueif and only if this type is assignable to the second
-
getInterfaces
- Specified by:
getInterfacesin interfaceClassElement- Overrides:
getInterfacesin classAbstractPythonClassElement- Returns:
- The interfaces implemented by this class element
-
isInterface
public boolean isInterface()- Returns:
- Whether the class element is an interface
-
getSuperType
Description copied from interface:ClassElementReturns the super type of this element or empty if the element has no super type.- Returns:
- An optional of the super type
-
getTypeArguments
- Returns:
- The type arguments for this class element
-
getAllTypeArguments
Description copied from interface:ClassElementBuilds a map of all the type parameters for a class, its super classes and interfaces. The resulting map contains the name of the class to the map of the resolved generic types.- Returns:
- The type arguments for this class element
-
withTypeArguments
Description copied from interface:ClassElementCopies this element and overrides its type arguments.- Parameters:
typeArguments- The type arguments- Returns:
- A new element
-
getDeclaredGenericPlaceholders
Description copied from interface:ClassElementThe type arguments declared on the raw class. Independent of the actualbound type arguments.This method will resolve the generic placeholders defined of the declaring class, if any.
For example
List<String>will result a single placeholder calledEof typeObject.- Returns:
- The type arguments declared on this class.
-
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
-