Package nonapi.io.github.classgraph.json
Class FieldTypeInfo
- java.lang.Object
-
- nonapi.io.github.classgraph.json.FieldTypeInfo
-
class FieldTypeInfo extends java.lang.ObjectInformation on the type of a field.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFieldTypeInfo.PrimitiveTypeThe Enum PrimitiveType.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.Constructor<?>constructorForFieldTypeWithSizeHintThe constructor with int-valued size hint for the type of the field, or null if this is not a Collection or Map.private java.lang.reflect.Constructor<?>defaultConstructorForFieldTypeThe 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) java.lang.reflect.FieldfieldThe field.private java.lang.reflect.TypefieldTypePartiallyResolvedThe type of the field after any concrete type arguments of a specific subclass have been substituted into type parameter variables.private booleanhasUnresolvedTypeVariablesTrue if the field still has unresolved type variables from the defining subclass.private booleanisTypeVariableIf 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 FieldTypeInfo.PrimitiveTypeprimitiveTypeThe index of the type: 0 for non-primitive type; 1-8 for primitive types.
-
Constructor Summary
Constructors Constructor Description FieldTypeInfo(java.lang.reflect.Field field, java.lang.reflect.Type fieldTypePartiallyResolved, ClassFieldCache classFieldCache)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.Constructor<?>getConstructorForFieldTypeWithSizeHint(java.lang.reflect.Type fieldTypeFullyResolved, ClassFieldCache classFieldCache)Get the constructor with size hint for the field type.java.lang.reflect.Constructor<?>getDefaultConstructorForFieldType(java.lang.reflect.Type fieldTypeFullyResolved, ClassFieldCache classFieldCache)Get the default constructor for the field type.java.lang.reflect.TypegetFullyResolvedFieldType(TypeResolutions typeResolutions)Get the fully resolved field type.private static booleanhasTypeVariables(java.lang.reflect.Type type)Check if the type has type variables.(package private) voidsetFieldValue(java.lang.Object containingObj, java.lang.Object value)Set the field's value, appropriately handling primitive-typed fields.java.lang.StringtoString()
-
-
-
Field Detail
-
field
final java.lang.reflect.Field field
The field.
-
fieldTypePartiallyResolved
private final java.lang.reflect.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 java.lang.reflect.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 java.lang.reflect.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 Detail
-
FieldTypeInfo
public FieldTypeInfo(java.lang.reflect.Field field, java.lang.reflect.Type fieldTypePartiallyResolved, ClassFieldCache classFieldCache)Constructor.- Parameters:
field- the fieldfieldTypePartiallyResolved- the field type, partially resolvedclassFieldCache- the class field cache
-
-
Method Detail
-
hasTypeVariables
private static boolean hasTypeVariables(java.lang.reflect.Type type)
Check if the type has type variables.- Parameters:
type- the type- Returns:
- true if the type has type variables.
-
getConstructorForFieldTypeWithSizeHint
public java.lang.reflect.Constructor<?> getConstructorForFieldTypeWithSizeHint(java.lang.reflect.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 java.lang.reflect.Constructor<?> getDefaultConstructorForFieldType(java.lang.reflect.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
public java.lang.reflect.Type getFullyResolvedFieldType(TypeResolutions typeResolutions)
Get the fully resolved field type.- Parameters:
typeResolutions- the type resolutions- Returns:
- the fully resolved field type
-
setFieldValue
void setFieldValue(java.lang.Object containingObj, java.lang.Object value)Set the field's value, appropriately handling primitive-typed fields.- Parameters:
containingObj- the containing objectvalue- the field value
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-