Record Class PythonProcessingEnvironment
java.lang.Object
java.lang.Record
io.micronaut.python.processing.PythonProcessingEnvironment
- Record Components:
environment- The underlying Python environment containing classes and decorators.annotationMetadataBuilder- The builder for creating annotation metadata from Python elements.metadataFactory- The factory for creating element annotation metadata.javaVisitorContext- The backing Java visitor context.visitorContext- The visitor context for processing Python elements.originatingElement- The Java element that triggered Python processing.classesCache- The per-processing-run class element cache.scriptsCache- The per-processing-run script element cache.
- All Implemented Interfaces:
AutoCloseable
public record PythonProcessingEnvironment(PythonEnvironment environment, PythonAnnotationMetadataBuilder annotationMetadataBuilder, PythonElementAnnotationMetadataFactory metadataFactory, JavaVisitorContext javaVisitorContext, PythonVisitorContext visitorContext, Element originatingElement, AtomicReference<Map<String, ClassElement>> classesCache, AtomicReference<Map<String, ClassElement>> scriptsCache)
extends Record
implements AutoCloseable
Represents a Python processing environment that extends the basic Python environment with additional
processing capabilities for annotation metadata and visitor context. This record is used during
Micronaut's annotation processing phase to handle Python code integration.
- Since:
- 5.2.0
- Author:
- Micronaut
-
Constructor Summary
ConstructorsConstructorDescriptionPythonProcessingEnvironment(PythonEnvironment environment) Creates a Python processing environment with the specified Python environment.PythonProcessingEnvironment(PythonEnvironment environment, JavaVisitorContext javaVisitorContext) Creates a Python processing environment with the specified Python environment.PythonProcessingEnvironment(PythonEnvironment environment, JavaVisitorContext javaVisitorContext, Element originatingElement) Creates a Python processing environment with the specified Python environment.PythonProcessingEnvironment(PythonEnvironment environment, PythonAnnotationMetadataBuilder annotationMetadataBuilder, PythonElementAnnotationMetadataFactory metadataFactory, JavaVisitorContext javaVisitorContext, PythonVisitorContext visitorContext, Element originatingElement) PythonProcessingEnvironment(PythonEnvironment environment, PythonAnnotationMetadataBuilder annotationMetadataBuilder, PythonElementAnnotationMetadataFactory metadataFactory, JavaVisitorContext javaVisitorContext, PythonVisitorContext visitorContext, Element originatingElement, AtomicReference<Map<String, ClassElement>> classesCache, AtomicReference<Map<String, ClassElement>> scriptsCache) Creates an instance of aPythonProcessingEnvironmentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theannotationMetadataBuilderrecord component.classes()Returns a map of Python class elements, converting the raw class definitions into processing-ready elements with annotation metadata support.Returns the value of theclassesCacherecord component.voidclose()Closes the Python processing environment by closing the underlying Python environment.Returns the value of theenvironmentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thejavaVisitorContextrecord component.Returns the value of themetadataFactoryrecord component.Returns the value of theoriginatingElementrecord component.scripts()Returns a map of Python script elements, converting the raw script definitions into processing-ready elements with annotation metadata support.Returns the value of thescriptsCacherecord component.Returns the script element cache without initializing it.final StringtoString()Returns a string representation of this record class.Returns the value of thevisitorContextrecord component.
-
Constructor Details
-
PythonProcessingEnvironment
public PythonProcessingEnvironment(PythonEnvironment environment, JavaVisitorContext javaVisitorContext, Element originatingElement) Creates a Python processing environment with the specified Python environment. The annotation metadata builder, metadata factory, and visitor context will be initialized automatically.- Parameters:
environment- The Python environment to use.javaVisitorContext- The java visitor contextoriginatingElement- The originating element
-
PythonProcessingEnvironment
public PythonProcessingEnvironment(PythonEnvironment environment, PythonAnnotationMetadataBuilder annotationMetadataBuilder, PythonElementAnnotationMetadataFactory metadataFactory, JavaVisitorContext javaVisitorContext, PythonVisitorContext visitorContext, Element originatingElement) -
PythonProcessingEnvironment
public PythonProcessingEnvironment(PythonEnvironment environment, JavaVisitorContext javaVisitorContext) Creates a Python processing environment with the specified Python environment. The annotation metadata builder, metadata factory, and visitor context will be initialized automatically.- Parameters:
environment- The Python environment to use.javaVisitorContext- The java visitor context
-
PythonProcessingEnvironment
Creates a Python processing environment with the specified Python environment. The annotation metadata builder, metadata factory, and visitor context will be initialized automatically.- Parameters:
environment- The Python environment to use.
-
PythonProcessingEnvironment
public PythonProcessingEnvironment(PythonEnvironment environment, PythonAnnotationMetadataBuilder annotationMetadataBuilder, PythonElementAnnotationMetadataFactory metadataFactory, JavaVisitorContext javaVisitorContext, PythonVisitorContext visitorContext, Element originatingElement, AtomicReference<Map<String, ClassElement>> classesCache, AtomicReference<Map<String, ClassElement>> scriptsCache) Creates an instance of aPythonProcessingEnvironmentrecord class.- Parameters:
environment- the value for theenvironmentrecord componentannotationMetadataBuilder- the value for theannotationMetadataBuilderrecord componentmetadataFactory- the value for themetadataFactoryrecord componentjavaVisitorContext- the value for thejavaVisitorContextrecord componentvisitorContext- the value for thevisitorContextrecord componentoriginatingElement- the value for theoriginatingElementrecord componentclassesCache- the value for theclassesCacherecord componentscriptsCache- the value for thescriptsCacherecord component
-
-
Method Details
-
close
public void close()Closes the Python processing environment by closing the underlying Python environment.- Specified by:
closein interfaceAutoCloseable
-
classes
Returns a map of Python class elements, converting the raw class definitions into processing-ready elements with annotation metadata support.- Returns:
- A map of class names to Python class elements.
-
scripts
Returns a map of Python script elements, converting the raw script definitions into processing-ready elements with annotation metadata support.- Returns:
- A map of script names to Python script elements.
-
scriptsIfInitialized
Returns the script element cache without initializing it.- Returns:
- The cached script elements, or
nullif scripts have not been initialized yet.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
environment
Returns the value of theenvironmentrecord component.- Returns:
- the value of the
environmentrecord component
-
annotationMetadataBuilder
Returns the value of theannotationMetadataBuilderrecord component.- Returns:
- the value of the
annotationMetadataBuilderrecord component
-
metadataFactory
Returns the value of themetadataFactoryrecord component.- Returns:
- the value of the
metadataFactoryrecord component
-
javaVisitorContext
Returns the value of thejavaVisitorContextrecord component.- Returns:
- the value of the
javaVisitorContextrecord component
-
visitorContext
Returns the value of thevisitorContextrecord component.- Returns:
- the value of the
visitorContextrecord component
-
originatingElement
Returns the value of theoriginatingElementrecord component.- Returns:
- the value of the
originatingElementrecord component
-
classesCache
Returns the value of theclassesCacherecord component.- Returns:
- the value of the
classesCacherecord component
-
scriptsCache
Returns the value of thescriptsCacherecord component.- Returns:
- the value of the
scriptsCacherecord component
-