Class FieldModel
-
- All Implemented Interfaces:
public final class FieldModel extends Record
Model representing a GraphQL field for code generation.
-
-
Constructor Summary
Constructors Constructor Description FieldModel()
-
Method Summary
Modifier and Type Method Description static FieldModelsimple(String name, String javaType, boolean nullable)Creates a simple scalar FieldModel with no composite/enum/abstract type metadata. StringgetName()StringgetSafeName()Returns a Java-safe identifier name. StringgetJavaType()booleangetNullable()booleangetCompositeType()Returns whether this field's base type is a composite object or nested input type. booleangetList()Returns whether this field is a list type. booleangetEnumType()Returns whether this field's base type is an enum. booleangetAbstractType()Returns whether this field's base type is an interface or union (abstract composite type). StringgetBaseTypeName()Returns the simple class name of the base type (for composite and enum fields). booleangetCompositeList()Returns true if this is a list of composite objects. booleangetAbstractList()Returns true if this is a list of abstract composite types (interfaces/unions). booleangetEnumList()Returns true if this is a list of enums. booleangetScalarList()Returns true if this is a list of scalar values (not composites, not enums). StringgetScalarCoercionHint()Returns the GraphQL scalar type name for temporal types that need coercion at runtime, or null for non-temporal scalars. booleangetHasScalarCoercionHint()Returns true if this field needs temporal scalar coercion. booleangetTemporalScalar()Returns true if this is a non-list temporal scalar field needing coercion. booleangetTemporalScalarList()Returns true if this is a list of temporal scalar values needing coercion. StringgetGetterName()Returns the getter method name for this field. -
-
Method Detail
-
simple
static FieldModel simple(String name, String javaType, boolean nullable)
Creates a simple scalar FieldModel with no composite/enum/abstract type metadata. Useful for tests and scalar fields.
-
getSafeName
String getSafeName()
Returns a Java-safe identifier name. If the field name is a Java reserved keyword or reserved identifier, appends
_to avoid compilation errors (e.g.,double→double_,_→__).
-
getJavaType
String getJavaType()
-
getNullable
boolean getNullable()
-
getCompositeType
boolean getCompositeType()
Returns whether this field's base type is a composite object or nested input type.
-
getList
boolean getList()
Returns whether this field is a list type.
-
getEnumType
boolean getEnumType()
Returns whether this field's base type is an enum.
-
getAbstractType
boolean getAbstractType()
Returns whether this field's base type is an interface or union (abstract composite type).
-
getBaseTypeName
String getBaseTypeName()
Returns the simple class name of the base type (for composite and enum fields).
-
getCompositeList
boolean getCompositeList()
Returns true if this is a list of composite objects. Used for ST template conditionals.
-
getAbstractList
boolean getAbstractList()
Returns true if this is a list of abstract composite types (interfaces/unions). Used for ST template conditionals.
-
getEnumList
boolean getEnumList()
Returns true if this is a list of enums. Used for ST template conditionals.
-
getScalarList
boolean getScalarList()
Returns true if this is a list of scalar values (not composites, not enums). Used for ST template conditionals.
-
getScalarCoercionHint
String getScalarCoercionHint()
Returns the GraphQL scalar type name for temporal types that need coercion at runtime, or null for non-temporal scalars. Maps Java types back to their GraphQL scalar names: Instant → "DateTime", LocalDate → "Date", OffsetTime → "Time".
-
getHasScalarCoercionHint
boolean getHasScalarCoercionHint()
Returns true if this field needs temporal scalar coercion.
-
getTemporalScalar
boolean getTemporalScalar()
Returns true if this is a non-list temporal scalar field needing coercion.
-
getTemporalScalarList
boolean getTemporalScalarList()
Returns true if this is a list of temporal scalar values needing coercion.
-
getGetterName
String getGetterName()
Returns the getter method name for this field.
-
-
-
-