Class PythonElementAnnotationMetadataFactory
java.lang.Object
io.micronaut.inject.ast.annotation.AbstractElementAnnotationMetadataFactory<ElementDef, DecoratorDef>
io.micronaut.python.processing.annotation.PythonElementAnnotationMetadataFactory
- All Implemented Interfaces:
ElementAnnotationMetadataFactory
public class PythonElementAnnotationMetadataFactory
extends AbstractElementAnnotationMetadataFactory<ElementDef, DecoratorDef>
Factory for creating and managing annotation metadata for Python elements.
This class extends AbstractElementAnnotationMetadataFactory and provides
support for reading and building annotation metadata based on Python decorators.
The factory delegates annotation processing logic to PythonAnnotationMetadataBuilder.
The metadata factory may be used in either a read-only or mutable context, depending
on how it is constructed. To enforce immutability, use readOnly() to obtain a read-only factory.
Typical usage:
PythonAnnotationMetadataBuilder builder = ...;
PythonElementAnnotationMetadataFactory factory =
new PythonElementAnnotationMetadataFactory(false, builder);
ElementAnnotationMetadata metadata = factory.build(someElement);
- Since:
- 5.2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractElementAnnotationMetadataFactory
AbstractElementAnnotationMetadataFactory.AbstractElementAnnotationMetadata, AbstractElementAnnotationMetadataFactory.MutableElementAnnotationMetadata -
Field Summary
Fields inherited from class AbstractElementAnnotationMetadataFactory
isReadOnly, metadataBuilder -
Constructor Summary
ConstructorsConstructorDescriptionPythonElementAnnotationMetadataFactory(boolean isReadOnly, PythonAnnotationMetadataBuilder annotationMetadataBuilder) Constructs a new factory for Python element annotation metadata. -
Method Summary
Modifier and TypeMethodDescriptionlookupForMethod(MethodElement methodElement) Lookup annotation metadata for the method.lookupForParameter(ParameterElement parameterElement) Lookup annotation metadata for the parameter.lookupTypeAnnotationsForClass(ClassElement classElement) Lookup annotation metadata for the class.readOnly()Creates a read-only version of this element annotation metadata factory.
-
Constructor Details
-
PythonElementAnnotationMetadataFactory
public PythonElementAnnotationMetadataFactory(boolean isReadOnly, PythonAnnotationMetadataBuilder annotationMetadataBuilder) Constructs a new factory for Python element annotation metadata.- Parameters:
isReadOnly- Whether the factory should operate in read-only mode (no shared cache modifications).annotationMetadataBuilder- The annotation metadata builder used to introspect Python decorators.
-
-
Method Details
-
readOnly
Creates a read-only version of this element annotation metadata factory. No modifications to annotation metadata will be persisted within the shared cache.- Returns:
- a read-only element annotation metadata factory
-
lookupTypeAnnotationsForClass
protected AbstractAnnotationMetadataBuilder.CachedAnnotationMetadata lookupTypeAnnotationsForClass(ClassElement classElement) Description copied from class:AbstractElementAnnotationMetadataFactoryLookup annotation metadata for the class.- Overrides:
lookupTypeAnnotationsForClassin classAbstractElementAnnotationMetadataFactory<ElementDef, DecoratorDef>- Parameters:
classElement- The element- Returns:
- The annotation metadata
-
lookupForMethod
protected AbstractAnnotationMetadataBuilder.CachedAnnotationMetadata lookupForMethod(MethodElement methodElement) Description copied from class:AbstractElementAnnotationMetadataFactoryLookup annotation metadata for the method.- Overrides:
lookupForMethodin classAbstractElementAnnotationMetadataFactory<ElementDef, DecoratorDef>- Parameters:
methodElement- The element- Returns:
- The annotation metadata
-
lookupForParameter
protected AbstractAnnotationMetadataBuilder.CachedAnnotationMetadata lookupForParameter(ParameterElement parameterElement) Description copied from class:AbstractElementAnnotationMetadataFactoryLookup annotation metadata for the parameter.- Overrides:
lookupForParameterin classAbstractElementAnnotationMetadataFactory<ElementDef, DecoratorDef>- Parameters:
parameterElement- The element- Returns:
- The annotation metadata
-