Class FieldTypeInfo

java.lang.Object
nonapi.io.github.classgraph.json.FieldTypeInfo

class FieldTypeInfo extends Object
Information on the type of a field.
  • Field Details

    • field

      final Field field
      The field.
    • fieldTypePartiallyResolved

      private final Type fieldTypePartiallyResolved
      The type of the field after any concrete type arguments of a specific subclass have been substituted into type parameter variables. There may still be type variables present, if the subclass itself has unresolved type variables.
    • hasUnresolvedTypeVariables

      private final boolean hasUnresolvedTypeVariables
      True if the field still has unresolved type variables from the defining subclass.
    • isTypeVariable

      private final boolean isTypeVariable
      If the type of this field is a type variable, it could be any type, so we need to defer getting and caching the constructor in this case.
    • primitiveType

      private final FieldTypeInfo.PrimitiveType primitiveType
      The index of the type: 0 for non-primitive type; 1-8 for primitive types.
    • constructorForFieldTypeWithSizeHint

      private Constructor<?> constructorForFieldTypeWithSizeHint
      The constructor with int-valued size hint for the type of the field, or null if this is not a Collection or Map.
    • defaultConstructorForFieldType

      private Constructor<?> defaultConstructorForFieldType
      The default (no-arg) constructor for the type of the field, or null if this is a primitive field, or if intConstructorForFieldType is non-null.
  • Constructor Details

    • FieldTypeInfo

      public FieldTypeInfo(Field field, Type fieldTypePartiallyResolved, ClassFieldCache classFieldCache)
      Constructor.
      Parameters:
      field - the field
      fieldTypePartiallyResolved - the field type, partially resolved
      classFieldCache - the class field cache
  • Method Details

    • hasTypeVariables

      private static boolean hasTypeVariables(Type type)
      Check if the type has type variables.
      Parameters:
      type - the type
      Returns:
      true if the type has type variables.
    • getConstructorForFieldTypeWithSizeHint

      public Constructor<?> getConstructorForFieldTypeWithSizeHint(Type fieldTypeFullyResolved, ClassFieldCache classFieldCache)
      Get the constructor with size hint for the field type.
      Parameters:
      fieldTypeFullyResolved - the field type
      classFieldCache - the class field cache
      Returns:
      the constructor with size hint for the field type
    • getDefaultConstructorForFieldType

      public Constructor<?> getDefaultConstructorForFieldType(Type fieldTypeFullyResolved, ClassFieldCache classFieldCache)
      Get the default constructor for the field type.
      Parameters:
      fieldTypeFullyResolved - the field type
      classFieldCache - the class field cache
      Returns:
      the default constructor for the field type
    • getFullyResolvedFieldType

      public Type getFullyResolvedFieldType(TypeResolutions typeResolutions)
      Get the fully resolved field type.
      Parameters:
      typeResolutions - the type resolutions
      Returns:
      the fully resolved field type
    • setFieldValue

      void setFieldValue(Object containingObj, Object value)
      Set the field's value, appropriately handling primitive-typed fields.
      Parameters:
      containingObj - the containing object
      value - the field value
    • toString

      public String toString()
      Overrides:
      toString in class Object