Record Class ClassTypeDef.Parameterized

java.lang.Object
java.lang.Record
io.micronaut.sourcegen.model.ClassTypeDef.Parameterized
Record Components:
rawType - The raw type definition
typeArguments - The type arguments
All Implemented Interfaces:
ClassTypeDef, TypeDef
Enclosing interface:
ClassTypeDef

public static record ClassTypeDef.Parameterized(ClassTypeDef rawType, List<TypeDef> typeArguments) extends Record implements ClassTypeDef
The parameterized type definition.
Since:
1.0
Author:
Denis Stepanov
  • Constructor Details

    • Parameterized

      public Parameterized(ClassTypeDef rawType, List<TypeDef> typeArguments)
      Creates an instance of a Parameterized record class.
      Parameters:
      rawType - the value for the rawType record component
      typeArguments - the value for the typeArguments record component
  • Method Details

    • resolveTypeVariables

      public ClassTypeDef.Parameterized resolveTypeVariables(Function<String, @Nullable TypeDef> resolveVariableFn)
      Description copied from interface: TypeDef
      Resolve the type variables.
      Specified by:
      resolveTypeVariables in interface ClassTypeDef
      Specified by:
      resolveTypeVariables in interface TypeDef
      Parameters:
      resolveVariableFn - The resolved variable function
      Returns:
      The resolved type or the previous.
    • 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
    • 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
    • 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
    • getName

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

      public String getSimpleName()
      Specified by:
      getSimpleName in interface ClassTypeDef
      Returns:
      The simple name
    • getCanonicalName

      public String getCanonicalName()
      Specified by:
      getCanonicalName in interface ClassTypeDef
      Returns:
      The canonical type name
    • 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
    • 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
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • rawType

      public ClassTypeDef rawType()
      Returns the value of the rawType record component.
      Returns:
      the value of the rawType record component
    • typeArguments

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