Record Class PythonEnvironment

java.lang.Object
java.lang.Record
io.micronaut.python.processing.PythonEnvironment
Record Components:
classes - A map of Python class names to their definitions.
scripts - A map of Python script names to their definitions.
decorators - A map of Python decorator names to their definitions.
context - The GraalVM Polyglot context used for executing Python code.
All Implemented Interfaces:
AutoCloseable

public record PythonEnvironment(Map<String,ClassDef> classes, Map<String, ScriptDef> scripts, Map<String, DecoratorDef> decorators, org.graalvm.polyglot.Context context) extends Record implements AutoCloseable
Represents a Python environment containing parsed Python classes, decorators, scripts, and the GraalVM Polyglot context. This record holds the state of a Python module after parsing, providing access to class definitions, script definitions, and decorators.
Since:
5.2.0
Author:
Micronaut
  • Constructor Details

    • PythonEnvironment

      public PythonEnvironment(Map<String,ClassDef> classes, Map<String, ScriptDef> scripts, Map<String, DecoratorDef> decorators, org.graalvm.polyglot.Context context)
      Creates an instance of a PythonEnvironment record class.
      Parameters:
      classes - the value for the classes record component
      scripts - the value for the scripts record component
      decorators - the value for the decorators record component
      context - the value for the context record component
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • classes

      public Map<String,ClassDef> classes()
      Returns the value of the classes record component.
      Returns:
      the value of the classes record component
    • scripts

      public Map<String, ScriptDef> scripts()
      Returns the value of the scripts record component.
      Returns:
      the value of the scripts record component
    • decorators

      public Map<String, DecoratorDef> decorators()
      Returns the value of the decorators record component.
      Returns:
      the value of the decorators record component
    • context

      public org.graalvm.polyglot.Context context()
      Returns the value of the context record component.
      Returns:
      the value of the context record component