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

java.lang.Object
no.sikt.graphitron.definitions.fields.AbstractField<T>
no.sikt.graphitron.definitions.fields.GenerationSourceField<T>
All Implemented Interfaces:
FieldSpecification, GenerationField, GenerationTarget
Direct Known Subclasses:
InputField, ObjectField

public abstract class GenerationSourceField<T extends graphql.language.NamedNode<T> & graphql.language.DirectivesContainer<T>> extends AbstractField<T> implements GenerationField
This class represents the general functionality associated with GraphQLs fields that can initialise code generation.
  • Constructor Details

    • GenerationSourceField

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

    • createsDataFetcher

      public boolean createsDataFetcher()
      Specified by:
      createsDataFetcher in interface GenerationTarget
      Returns:
      Does this element lead to the generation of additional data fetchers?
    • isExternalField

      public boolean isExternalField()
      Specified by:
      isExternalField in interface GenerationField
    • hasFieldDirective

      public boolean hasFieldDirective()
      Specified by:
      hasFieldDirective in interface GenerationField
    • getMappingForRecordFieldOverride

      public MethodMapping getMappingForRecordFieldOverride()
      Specified by:
      getMappingForRecordFieldOverride in interface GenerationField
      Returns:
      Record-side method mapping based on the name of the field or the directive GenerationDirective.FIELD set on this type.
    • getJavaRecordMethodMapping

      public MethodMapping getJavaRecordMethodMapping(boolean mapsJavaRecord)
      Get the method mapping for Java record field access.
      Specified by:
      getJavaRecordMethodMapping in interface GenerationField
      Parameters:
      mapsJavaRecord - true for types with @record directive (uses raw @field name), false otherwise (uses toCamelCase)
      Returns:
      The appropriate MethodMapping for getter/setter generation
    • getFieldRecordMappingName

      public String getFieldRecordMappingName()
      Specified by:
      getFieldRecordMappingName in interface GenerationField
      Returns:
      Record-side name mapping based on the name of the field or the GenerationDirective.FIELD directive set on this type.
    • getFieldReferences

      public List<FieldReference> getFieldReferences()
      Specified by:
      getFieldReferences in interface GenerationField
    • hasFieldReferences

      public boolean hasFieldReferences()
      Specified by:
      hasFieldReferences in interface GenerationField
    • getMultitableReferences

      public Map<String,List<FieldReference>> getMultitableReferences()
    • hasMultitableReferences

      public boolean hasMultitableReferences()
    • getCondition

      public SQLCondition getCondition()
      Specified by:
      getCondition in interface GenerationField
    • hasCondition

      public boolean hasCondition()
      Specified by:
      hasCondition in interface GenerationField
    • hasOverridingCondition

      public boolean hasOverridingCondition()
      Specified by:
      hasOverridingCondition in interface GenerationField
    • isGenerated

      public boolean isGenerated()
      Specified by:
      isGenerated in interface GenerationTarget
      Returns:
      Should this object be generated?
    • hasServiceReference

      public boolean hasServiceReference()
      Specified by:
      hasServiceReference in interface GenerationField
      Returns:
      Does this field have a service reference defined?
    • getExternalMethod

      public ServiceWrapper getExternalMethod()
      Specified by:
      getExternalMethod in interface GenerationField
      Returns:
      The wrapper object for a service reference, if the field has a service set. Otherwise, null.
    • getContextFields

      public Map<String,no.sikt.graphitron.javapoet.TypeName> getContextFields()
      Specified by:
      getContextFields in interface GenerationField
      Returns:
      Get any context fields related to this field. This may be either service or condition context fields (without duplicates).
    • hasMutationType

      public boolean hasMutationType()
      Specified by:
      hasMutationType in interface GenerationField
      Returns:
      Does this field have a mutation operation defined?
    • getMutationType

      public MutationType getMutationType()
      Specified by:
      getMutationType in interface GenerationField
      Returns:
      The type of mutation that should be applied in this operation.
    • isGeneratedWithResolver

      public boolean isGeneratedWithResolver()
      Specified by:
      isGeneratedWithResolver in interface GenerationTarget
      Returns:
      Should this object be generated as or containing resolvers?
    • markAsImplicitSplitQuery

      public void markAsImplicitSplitQuery()
      Mark this field as an implicit split query, giving it the same behavior as an explicit @splitQuery directive.
    • hasImplicitSplitQuery

      public boolean hasImplicitSplitQuery()
    • isExplicitlyNotGenerated

      public boolean isExplicitlyNotGenerated()
      Description copied from interface: GenerationTarget
      Does this have the GenerationDirective.NOT_GENERATED directive for skipping generation set?
      Specified by:
      isExplicitlyNotGenerated in interface GenerationTarget
    • hasNodeID

      public boolean hasNodeID()
      Specified by:
      hasNodeID in interface FieldSpecification
      Returns:
      Does this field have the @nodeId directive?
    • getNodeIdTypeName

      public Optional<String> getNodeIdTypeName()
      Specified by:
      getNodeIdTypeName in interface FieldSpecification
      Returns:
      The type name configured in the @nodeId directive
    • hasTableMethodDirective

      public boolean hasTableMethodDirective()
      Specified by:
      hasTableMethodDirective in interface GenerationField
    • formatPath

      public String formatPath()
      Specified by:
      formatPath in interface GenerationField
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object