Class PythonGenericPlaceholderElement
java.lang.Object
io.micronaut.inject.ast.annotation.AbstractAnnotationElement
io.micronaut.python.processing.element.AbstractPythonClassElement
io.micronaut.python.processing.element.PythonGenericPlaceholderElement
- All Implemented Interfaces:
ElementProvider, AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Named, MutableAnnotationMetadataDelegate<Element>, ArrayableClassElement, ClassElement, Element, GenericElement, GenericPlaceholderElement, TypedElement
public final class PythonGenericPlaceholderElement
extends AbstractPythonClassElement
implements GenericPlaceholderElement
Implementation of
GenericPlaceholderElement for Python TypeVars.- Since:
- 5.2.0
- Author:
- Micronaut
-
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
ConstructorsConstructorDescriptionPythonGenericPlaceholderElement(TypeVar typeVar, PythonProcessingEnvironment environment, List<ClassElement> bounds) PythonGenericPlaceholderElement(TypeVar typeVar, PythonProcessingEnvironment environment, List<ClassElement> bounds, Element declaringElement) -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micronaut.python.processing.element.AbstractPythonElementcopyThis()protected ClassElementcreateWithArrayDimensions(int arrayDimensions) booleanSupplies the metadata.protected MutableAnnotationMetadataDelegate<?> Get annotation metadata to add or remove annotations.@NonNull List<? extends ClassElement> Returns the bounds of this the generic placeholder empty.Returns the type parameter annotations.Python has no access modifiers, so the modifiers are derived from the visibility, static, abstract and final predicates of the element: an element is public unless its name marks it private, which keeps the modifier set consistent withElement.isPublic(),Element.isStatic(),Element.isAbstract()andElement.isFinal()for the callers that filter on modifiers, such asElementQuery.modifiers(...)andBeanElementBuilder.produceBeans(...).getName()Returns the type annotations.inthashCode()booleanisAssignable(String type) Tests whether one type is assignable to another.booleanbooleanisPublic()booleanIs raw type.booleanIn this case of callingClassElement.getTypeArguments()a returnedClassElementmay represent a type variable in which case this method will returntrue.protected final io.micronaut.python.processing.element.AbstractPythonElementmakeCopy()toString()withTypeUseAnnotationMetadata(ElementAnnotationMetadata typeUseAnnotationMetadata) The type variable used with type-use annotations, such asAnnotated[E, NotNull()]as a type argument.Methods inherited from class AbstractPythonClassElement
copyValues, element, excludeIntrospectedProperties, findPythonClass, getArrayDimensions, getBeanProperties, getBeanProperties, getDocumentation, getEnclosedElements, getFields, getInterfaces, getNativeType, getPackageName, getSyntheticBeanProperties, 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
addAssociatedBean, findDefaultStaticCreator, findField, findMethod, findStaticCreator, foldBoundGenericTypes, getAccessibleConstructors, getAccessibleStaticCreators, getAllTypeArguments, getBeanProperties, getBeanProperties, getBoundGenericTypes, getCanonicalName, getDeclaredGenericPlaceholders, getDefaultConstructor, getEnclosedElement, getEnclosedElements, getEnclosingType, getFields, getFirstTypeArgument, getInterfaces, getMethods, getOptionalValueType, getPackage, getPackageName, getPermittedSubclasses, getPrimaryConstructor, getRawClassElement, getSimpleName, getSuperType, getSyntheticBeanProperties, getType, getTypeArguments, getTypeArguments, getTypeArguments, hasUnresolvedTypes, isAssignable, isAssignable, isContainerType, isEnum, isGenericPlaceholder, isInner, isInterface, isIterable, isOptional, isProxy, isRecord, isSealed, isWildcard, withAnnotationMetadata, withBoundGenericTypes, withTypeArguments, withTypeArgumentsMethods inherited from interface Element
annotate, annotate, annotate, annotate, annotate, getDescription, getDescription, getDocumentation, getDocumentation, getModifiers, getName, getNativeType, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotypeMethods inherited from interface GenericElement
getGenericNativeType, resolvedMethods inherited from interface GenericPlaceholderElement
getRequiredDeclaringElement, getResolvedMethods inherited from interface TypedElement
getArrayDimensions, getGenericType, isArray, isPrimitive, isVoid
-
Constructor Details
-
PythonGenericPlaceholderElement
public PythonGenericPlaceholderElement(TypeVar typeVar, PythonProcessingEnvironment environment, List<ClassElement> bounds) -
PythonGenericPlaceholderElement
public PythonGenericPlaceholderElement(TypeVar typeVar, PythonProcessingEnvironment environment, List<ClassElement> bounds, Element declaringElement)
-
-
Method Details
-
withTypeUseAnnotationMetadata
public PythonGenericPlaceholderElement withTypeUseAnnotationMetadata(ElementAnnotationMetadata typeUseAnnotationMetadata) The type variable used with type-use annotations, such asAnnotated[E, NotNull()]as a type argument. The copy stays aGenericPlaceholderElement, so the type argument keeps naming the type variable.- Parameters:
typeUseAnnotationMetadata- The type-use annotation metadata of the type node- Returns:
- The annotated type variable
-
createWithArrayDimensions
- Specified by:
createWithArrayDimensionsin classAbstractPythonClassElement
-
copyThis
protected io.micronaut.python.processing.element.AbstractPythonElement copyThis()- Specified by:
copyThisin classAbstractPythonClassElement- Returns:
- copy of this element
-
getAnnotationMetadataToWrite
Description copied from class:AbstractAnnotationElementGet annotation metadata to add or remove annotations.- Overrides:
getAnnotationMetadataToWritein classAbstractPythonClassElement- Returns:
- The annotation metadata to write
-
getAnnotationMetadata
Description copied from interface:AnnotationMetadataProviderSupplies the metadata. Defaults toAnnotationMetadata.EMPTY_METADATA.- Specified by:
getAnnotationMetadatain interfaceAnnotationMetadataProvider- Overrides:
getAnnotationMetadatain classAbstractPythonClassElement- Returns:
- The
AnnotationMetadata
-
getTypeAnnotationMetadata
@NonNull public @NonNull MutableAnnotationMetadataDelegate<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- Overrides:
getTypeAnnotationMetadatain classAbstractPythonClassElement- Returns:
- the type annotations
-
getGenericTypeAnnotationMetadata
@NonNull public @NonNull MutableAnnotationMetadataDelegate<AnnotationMetadata> getGenericTypeAnnotationMetadata()Description copied from interface:GenericElementReturns the type parameter annotations. Added to this generic element by: - The declaration of the type variableElementType.TYPE_PARAMETER- The use of the typeElementType.TYPE- Specified by:
getGenericTypeAnnotationMetadatain interfaceGenericElement- Returns:
- the type annotations
-
isTypeVariable
public boolean isTypeVariable()Description copied from interface:ClassElementIn this case of callingClassElement.getTypeArguments()a returnedClassElementmay represent a type variable in which case this method will returntrue.- Specified by:
isTypeVariablein interfaceClassElement- Returns:
- Is this type a type variable.
-
isRawType
public boolean isRawType()Description copied from interface:ClassElementIs raw type.- Specified by:
isRawTypein interfaceClassElement- Returns:
- true if the type is raw
-
getBounds
Description copied from interface:GenericPlaceholderElementReturns the bounds of this the generic placeholder empty. Always returns a non-empty list.- Specified by:
getBoundsin interfaceGenericPlaceholderElement- Returns:
- The bounds declared for this type variable.
-
getVariableName
- Specified by:
getVariableNamein interfaceGenericPlaceholderElement- Returns:
- The name of the placeholder variable.
-
getDeclaringElement
- Specified by:
getDeclaringElementin interfaceGenericPlaceholderElement- Returns:
- The element declaring this variable, if it can be determined. Must be either a method or a class.
-
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
-
toString
-
makeCopy
protected final io.micronaut.python.processing.element.AbstractPythonElement makeCopy() -
getName
-
isProtected
public boolean isProtected()- Specified by:
isProtectedin interfaceElement- Returns:
- True if the element is protected.
-
isPublic
-
getModifiers
Python has no access modifiers, so the modifiers are derived from the visibility, static, abstract and final predicates of the element: an element is public unless its name marks it private, which keeps the modifier set consistent withElement.isPublic(),Element.isStatic(),Element.isAbstract()andElement.isFinal()for the callers that filter on modifiers, such asElementQuery.modifiers(...)andBeanElementBuilder.produceBeans(...).- Specified by:
getModifiersin interfaceElement- Returns:
- The modifiers
-
equals
-
hashCode
-