Class RecordObjectDefinition<T extends graphql.language.TypeDefinition<T>,U extends GenerationField>

java.lang.Object
no.sikt.graphitron.definitions.objects.AbstractObjectDefinition<T,U>
no.sikt.graphitron.definitions.objects.RecordObjectDefinition<T,U>
All Implemented Interfaces:
GenerationTarget, ObjectSpecification<U>, RecordObjectSpecification<U>
Direct Known Subclasses:
InputDefinition, ObjectDefinition, UnionDefinition

public abstract class RecordObjectDefinition<T extends graphql.language.TypeDefinition<T>,U extends GenerationField> extends AbstractObjectDefinition<T,U> implements RecordObjectSpecification<U>
A generalized implementation of ObjectSpecification for types that can be linked to tables or records.
  • Constructor Details

    • RecordObjectDefinition

      public RecordObjectDefinition(T objectDefinition)
  • Method Details

    • isNonNullable

      protected boolean isNonNullable(GenerationField field)
      Returns:
      Is this field non-nullable in the database?
    • isGenerated

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

      public boolean isGeneratedWithResolver()
      Specified by:
      isGeneratedWithResolver in interface GenerationTarget
      Returns:
      Should this object be generated as or containing resolvers?
    • 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
    • getTable

      public JOOQMapping getTable()
      Specified by:
      getTable in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      Table objects which holds table names.
    • hasTable

      public boolean hasTable()
      Specified by:
      hasTable in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      Does this object have the "table" directive which implies a connection to a database table?
    • getRecordReference

      public Class<?> getRecordReference()
      Specified by:
      getRecordReference in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      The reference for a record class for this input type.
    • getRecordReferenceName

      public String getRecordReferenceName()
      Specified by:
      getRecordReferenceName in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      The reference name for a record class for this input type.
    • getRecordClassName

      public no.sikt.graphitron.javapoet.ClassName getRecordClassName()
      Specified by:
      getRecordClassName in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      The ClassName for the record that corresponds to this type.
    • hasJavaRecordReference

      public boolean hasJavaRecordReference()
      Specified by:
      hasJavaRecordReference in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      Does this input type have a record java class attached?
    • hasRecordReference

      public boolean hasRecordReference()
      Specified by:
      hasRecordReference in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      Does this input type have a record class attached?
    • asSourceClassName

      public no.sikt.graphitron.javapoet.ClassName asSourceClassName(boolean toRecord)
      Specified by:
      asSourceClassName in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      The ClassName for this object when it is considered the source of a mapping.
    • asTargetClassName

      public no.sikt.graphitron.javapoet.ClassName asTargetClassName(boolean toRecord)
      Specified by:
      asTargetClassName in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      The ClassName for this object when it is considered the target of a mapping.
    • asRecordName

      public String asRecordName()
      Specified by:
      asRecordName in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      The name of this object once it is transformed into a record.
    • getInputsSortedByNullability

      public List<U> getInputsSortedByNullability()
      Returns:
      List of input fields contained within this input type, sorted by whether they are nullable fields.
    • getRequiredInputs

      protected LinkedHashSet<String> getRequiredInputs()
    • isEntity

      public boolean isEntity()
      Specified by:
      isEntity in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      Is this type an entity according to the Apollo Federation specification?
    • getEntityKeys

      public EntityKeySet getEntityKeys()
      Specified by:
      getEntityKeys in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
      Returns:
      Apollo federation entity keys for this type.
    • hasNodeDirective

      public boolean hasNodeDirective()
      Specified by:
      hasNodeDirective in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
    • getTypeId

      public String getTypeId()
      Specified by:
      getTypeId in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
    • hasCustomTypeId

      public boolean hasCustomTypeId()
    • hasCustomKeyColumns

      public boolean hasCustomKeyColumns()
      Specified by:
      hasCustomKeyColumns in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>
    • getKeyColumns

      public LinkedList<String> getKeyColumns()
      Specified by:
      getKeyColumns in interface RecordObjectSpecification<T extends graphql.language.TypeDefinition<T>>