Record Class EnclosingScope

java.lang.Object
java.lang.Record
io.micronaut.sourcegen.bytecode.core.EnclosingScope
Record Components:
member - The inner class being written, or null for no scope
variables - The variables of its enclosing class

@Internal public record EnclosingScope(@Nullable ObjectDef member, List<TypeDef.TypeVariable> variables) extends Record
The variables of the enclosing class in scope of the inner class a writer writes - a member class that is not static - of the generated class the outer type names: Supplier<T> of an inner class of an Outer<T> names the T of Outer. A writer creates one for each class it writes and passes it with the definition to the descriptors and signatures it asks for.
Since:
2.3
  • Field Details

    • NONE

      public static final EnclosingScope NONE
      No variables of an enclosing class: a top-level or static class, or a type described outside of a class being written.
  • Constructor Details

    • EnclosingScope

      public EnclosingScope(@Nullable ObjectDef member, List<TypeDef.TypeVariable> variables)
      Creates an instance of a EnclosingScope record class.
      Parameters:
      member - the value for the member record component
      variables - the value for the variables record component
  • Method Details

    • of

      public static EnclosingScope of(ObjectDef objectDef, @Nullable ClassTypeDef outerType)
      The scope a definition is written in.
      Parameters:
      objectDef - The definition being written
      outerType - The type enclosing it, if any
      Returns:
      The scope, NONE where the definition is not an inner class of a generated class
    • variable

      public @Nullable TypeDef.TypeVariable variable(@Nullable ObjectDef objectDef, String name)
      A variable of the enclosing class in the scope of a definition.
      Parameters:
      objectDef - The definition whose scope it is
      name - The name of the variable
      Returns:
      The variable, or null where the definition is not the inner class being written or its enclosing class declares none of the name
    • 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.
    • member

      public @Nullable ObjectDef member()
      Returns the value of the member record component.
      Returns:
      the value of the member record component
    • variables

      public List<TypeDef.TypeVariable> variables()
      Returns the value of the variables record component.
      Returns:
      the value of the variables record component