Record Class ClassTypeDef.ClassDefType

java.lang.Object
java.lang.Record
io.micronaut.sourcegen.model.ClassTypeDef.ClassDefType
Record Components:
objectDef - The object def
nullable - Is nullable
All Implemented Interfaces:
ClassTypeDef, TypeDef
Enclosing interface:
ClassTypeDef

public static record ClassTypeDef.ClassDefType(ObjectDef objectDef, boolean nullable) extends Record implements ClassTypeDef
The class def element type.
Since:
1.2
Author:
Denis Stepanov
  • Constructor Details

    • ClassDefType

      public ClassDefType(ObjectDef objectDef, boolean nullable)
      Creates an instance of a ClassDefType record class.
      Parameters:
      objectDef - the value for the objectDef record component
      nullable - the value for the nullable record component
  • Method Details

    • getTypeVariableNames

      public List<String> getTypeVariableNames()
      Description copied from interface: ClassTypeDef
      The names of the type variables this type declares, in declaration order.

      Used to line up the arguments of a ClassTypeDef.Parameterized type with the variables the raw type declares. Only implementations that carry member information return anything.

      Specified by:
      getTypeVariableNames in interface ClassTypeDef
      Returns:
      The type variable names, or an empty list when they cannot be resolved
    • findDeclaredMethods

      public List<MethodDef> findDeclaredMethods(String name, int argumentCount)
      Description copied from interface: ClassTypeDef
      Find the methods this type declares that a call with the given name and number of arguments could target, variable arity included.

      Used by the convenience overloads that would otherwise build the invoked signature from the static types of the arguments, which names a method that does not exist whenever an argument is statically narrower than the declared parameter.

      Bridge methods are included, because their descriptors are real: a covariant override such as ReentrantReadWriteLock.readLock() leaves a bridge returning the supertype, and a call declaring that return type does resolve.

      Only implementations that carry member information return anything - ClassTypeDef.of(Class), ClassTypeDef.of(ClassElement) and a definition being generated. ClassTypeDef.of(String) has nothing to resolve against and returns an empty list, which leaves the signature inferred as before.

      Specified by:
      findDeclaredMethods in interface ClassTypeDef
      Parameters:
      name - The method name, or MethodDef.CONSTRUCTOR
      argumentCount - The number of arguments at the call site
      Returns:
      The candidate methods, or an empty list when they cannot be resolved
    • getLambda

      public LambdaDef getLambda(Function<String, @Nullable TypeDef> resolveVariableFn)
      Description copied from interface: ClassTypeDef
      Find the method that can be represented as a lambda.
      Specified by:
      getLambda in interface ClassTypeDef
      Parameters:
      resolveVariableFn - The resolved variable function
      Returns:
      The lambda method
    • getName

      public String getName()
      Specified by:
      getName in interface ClassTypeDef
      Returns:
      The type name
    • isInner

      public boolean isInner()
      Specified by:
      isInner in interface ClassTypeDef
      Returns:
      True if inner
    • isInterface

      public boolean isInterface()
      Specified by:
      isInterface in interface ClassTypeDef
      Returns:
      True if interface
    • isNullable

      public boolean isNullable()
      Specified by:
      isNullable in interface TypeDef
      Returns:
      Is nullable type
    • makeNullable

      public ClassTypeDef makeNullable()
      Specified by:
      makeNullable in interface ClassTypeDef
      Specified by:
      makeNullable in interface TypeDef
      Returns:
      A new nullable type
    • hashCode

      public 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 boolean equals(Object obj)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      obj - the object with which to compare
      Returns:
      true if this object is the same as the obj argument; false otherwise.
    • 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
    • objectDef

      public ObjectDef objectDef()
      Returns the value of the objectDef record component.
      Returns:
      the value of the objectDef record component
    • nullable

      public boolean nullable()
      Returns the value of the nullable record component.
      Returns:
      the value of the nullable record component