Class AbstractField<T extends graphql.language.NamedNode<T> & graphql.language.DirectivesContainer<T>>

java.lang.Object
no.sikt.graphitron.definitions.fields.AbstractField<T>
All Implemented Interfaces:
FieldSpecification
Direct Known Subclasses:
EnumField, GenerationSourceField, OrderByEnumField

public abstract class AbstractField<T extends graphql.language.NamedNode<T> & graphql.language.DirectivesContainer<T>> extends Object implements FieldSpecification
This class represents the general functionality associated with GraphQLs object fields.
  • Constructor Details

    • AbstractField

      public AbstractField(T field, String container)
    • AbstractField

      public AbstractField(T field, FieldType fieldType, String container)
  • Method Details

    • hasSetFieldOverride

      public boolean hasSetFieldOverride()
      Specified by:
      hasSetFieldOverride in interface FieldSpecification
      Returns:
      Does this field use the GenerationDirective.FIELD directive?
    • getTypeName

      public String getTypeName()
      Specified by:
      getTypeName in interface FieldSpecification
      Returns:
      The name of the field's underlying data type.
    • getContainerTypeName

      public String getContainerTypeName()
      Specified by:
      getContainerTypeName in interface FieldSpecification
      Returns:
      The name of the field's container schema type.
    • isID

      public boolean isID()
      Specified by:
      isID in interface FieldSpecification
      Returns:
      Is this field an ID?
    • isIterableWrapped

      public boolean isIterableWrapped()
      Specified by:
      isIterableWrapped in interface FieldSpecification
      Returns:
      Is this field wrapped in a list?
    • isNullable

      public boolean isNullable()
      Is this field nullable? In case of an iterable wrapped field, is the list nullable? E.g. [String!] will return true, and [String]! will return false.
      Specified by:
      isNullable in interface FieldSpecification
      Returns:
      Is this field optional/nullable?
    • isNonNullable

      public boolean isNonNullable()
      Is this field nullable? In case of an iterable wrapped field, is the list nullable? E.g. [String!] will return false, and [String]! will return true.
      Specified by:
      isNonNullable in interface FieldSpecification
      Returns:
      Is this field required/non-nullable?
    • isIterableWrappedWithNullableElement

      public boolean isIterableWrappedWithNullableElement()
      Is this an iterable wrapped field with a nullable element? Will return true: [String] and [String]! Will return false: [String!], [String!]! and String
      Specified by:
      isIterableWrappedWithNullableElement in interface FieldSpecification
    • getTypeClass

      public no.sikt.graphitron.javapoet.TypeName getTypeClass()
      Specified by:
      getTypeClass in interface FieldSpecification
      Returns:
      TypeName for this field's type.
    • getName

      public String getName()
      Specified by:
      getName in interface FieldSpecification
      Returns:
      The name of the object as specified in the schema.
    • getJavaName

      public String getJavaName()
    • getUpperCaseName

      public String getUpperCaseName()
      Specified by:
      getUpperCaseName in interface FieldSpecification
      Returns:
      The database equivalent name of this field. Defaults to field name.
    • getUnprocessedFieldOverrideInput

      public String getUnprocessedFieldOverrideInput()
    • getMappingFromSchemaName

      public MethodMapping getMappingFromSchemaName()
      Specified by:
      getMappingFromSchemaName in interface FieldSpecification
      Returns:
      Schema-side method name mappings based on the GraphQL equivalent of this field.
    • getMappingFromFieldOverride

      public MethodMapping getMappingFromFieldOverride()
      Specified by:
      getMappingFromFieldOverride in interface FieldSpecification
      Returns:
      DB-side method name mappings based on the database equivalent of this field.
    • isRootField

      public boolean isRootField()
      Specified by:
      isRootField in interface FieldSpecification
      Returns:
      Is this object field a Query or Mutation root field?
    • formatGraphQLSchemaType

      public String formatGraphQLSchemaType()