Package nonapi.io.github.classgraph.json
Class FieldTypeInfo
java.lang.Object
nonapi.io.github.classgraph.json.FieldTypeInfo
Information on the type of a field.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
The Enum PrimitiveType. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Constructor
<?> The constructor with int-valued size hint for the type of the field, or null if this is not a Collection or Map.private Constructor
<?> 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.(package private) final Field
The field.private final Type
The type of the field after any concrete type arguments of a specific subclass have been substituted into type parameter variables.private final boolean
True if the field still has unresolved type variables from the defining subclass.private final boolean
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.private final FieldTypeInfo.PrimitiveType
The index of the type: 0 for non-primitive type; 1-8 for primitive types. -
Constructor Summary
ConstructorsConstructorDescriptionFieldTypeInfo
(Field field, Type fieldTypePartiallyResolved, ClassFieldCache classFieldCache) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionConstructor
<?> getConstructorForFieldTypeWithSizeHint
(Type fieldTypeFullyResolved, ClassFieldCache classFieldCache) Get the constructor with size hint for the field type.Constructor
<?> getDefaultConstructorForFieldType
(Type fieldTypeFullyResolved, ClassFieldCache classFieldCache) Get the default constructor for the field type.getFullyResolvedFieldType
(TypeResolutions typeResolutions) Get the fully resolved field type.private static boolean
hasTypeVariables
(Type type) Check if the type has type variables.(package private) void
setFieldValue
(Object containingObj, Object value) Set the field's value, appropriately handling primitive-typed fields.toString()
-
Field Details
-
field
The field. -
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 hasUnresolvedTypeVariablesTrue if the field still has unresolved type variables from the defining subclass. -
isTypeVariable
private final boolean isTypeVariableIf 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
The index of the type: 0 for non-primitive type; 1-8 for primitive types. -
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
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
Constructor.- Parameters:
field
- the fieldfieldTypePartiallyResolved
- the field type, partially resolvedclassFieldCache
- the class field cache
-
-
Method Details
-
hasTypeVariables
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 typeclassFieldCache
- 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 typeclassFieldCache
- the class field cache- Returns:
- the default constructor for the field type
-
getFullyResolvedFieldType
Get the fully resolved field type.- Parameters:
typeResolutions
- the type resolutions- Returns:
- the fully resolved field type
-
setFieldValue
Set the field's value, appropriately handling primitive-typed fields.- Parameters:
containingObj
- the containing objectvalue
- the field value
-
toString
-