All Known Implementing Classes:
FieldImpl

public interface Field
This interface describes one field of one object type (or interface...). It aims to be simple enough, so that the Velocity template can easily generated the fields from it.
For instance:
 name: String!
 
is a Field of name 'name', type 'String', and is mandatory. or
 appearsIn: [Episode!]!
 
is a Field of name 'appearsIn', type 'Episode', is a list, is mandatory and its items are mandatory.
Author:
etienne-sf
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the annotation or annotations to add to this field, when in server mode, to serve the relation that this field holds
    Returns the list of directives that have been defined for this field, in the GraphQL schema
    default String
    Convert the given name, which can be in non camel case (for instance: ThisIsCamelCase) to a pascal case string (for instance: thisIsCamelCase).
    Returns the comments that have been found before this object, in the provided GraphQL schema
    Returns the data fetcher associated to this field, or null if this field has no data fetcher
    graphql.language.Value<?>
    Contains the default value..
    default String
    Returns the default value, as text, as it can be written into a generated GraphQL schema.
    A str string default value will be returned as "str",a JEDI enum value will be returned as JEDI, ...
    Returns the description for this object, in the provided GraphQL schema
    default Set<String>
    Return the list of java full classnames for this field, in all the interfaces implemented directly or indirectly by the owning type, and that contains this field.
    Returns the GraphQL type information, as it has been read from the AST.
    default String
    The full type of this field, as defined in the GraphQL schema.
    default String
    The type of this field, as defined in the GraphQL schema.
    All fields in an object may have parameters.
    default String
    The name of the field, as it can be used in the Java code.
    default String
    Returns the java type as it an be used to declare a variable or an attribute.
    default String
    Returns the java type as it an be used to declare a variable or an attribute, without declaring this type in the import list.
    The name of the field, as found in the GraphQL schema
    Retrieves the Type which contains this field
    Convert the given name, which is supposed to be in camel case (for instance: thisIsCamelCase) to a pascal case string (for instance: ThisIsCamelCase).
    Returns the Relation description for this field.
    Retrieves the Type for this field
    boolean
    Indicates whether this field is an id or not.
  • Method Details

    • getName

      String getName()
      The name of the field, as found in the GraphQL schema
      Returns:
      The name of the field
    • getGraphQLTypeSimpleName

      default String getGraphQLTypeSimpleName()
      The type of this field, as defined in the GraphQL schema. This type is either the type of the field (if it's not a list), or the type of the items in the list (if it's a list)
    • getGraphQLType

      default String getGraphQLType()
      The full type of this field, as defined in the GraphQL schema. For instance, a list of list of String, where everything is mandatory would be [[String!]!]!
    • getFieldTypeAST

      FieldTypeAST getFieldTypeAST()
      Returns the GraphQL type information, as it has been read from the AST. See FieldTypeAST for more information, here.
      Returns:
    • getJavaName

      default String getJavaName()
      The name of the field, as it can be used in the Java code. If the name is a java keyword (class, default, break...), the java name it prefixed by an underscore.
      Returns:
      The name of the field, as it can be used in Java code
    • getJavaType

      default String getJavaType()
      Returns the java type as it an be used to declare a variable or an attribute. For instance, a field of GraphQL type [ID], in client mode (where an ID is a java String), the result would be: List<String>. This always uses the java short name. So the proper import must be added into the enclosing java file.
    • getJavaTypeFullClassname

      default String getJavaTypeFullClassname()
      Returns the java type as it an be used to declare a variable or an attribute, without declaring this type in the import list. For instance, a field of GraphQL type [ID], in client mode (where an ID is a java String), the result would be: List<java.lang.String>. This always uses the full class name. So the proper import doesn't need to be added into the enclosing java file.
    • getFieldJavaFullClassnamesFromImplementedInterface

      default Set<String> getFieldJavaFullClassnamesFromImplementedInterface()
      Return the list of java full classnames for this field, in all the interfaces implemented directly or indirectly by the owning type, and that contains this field.
      For instance, in the next sample, when called for bar's field of TFoo, this method returns a Set that contains the full java class names for both IBar1 and IBar2:
      interface IBar1 { id: ID } interface IBar2 { id: ID } interface IFoo1 { id: ID bar: IBar1 } interface IFoo2 { id: ID bar: IBar2 } type TBar12 implements IBar1 & IBar2 { id: ID } type TFoo implements IFoo1 & IFoo2 { id: ID bar: TBar12 }
      Returns:
    • getOwningType

      Type getOwningType()
      Retrieves the Type which contains this field
      Returns:
    • getType

      Type getType()
      Retrieves the Type for this field
      Returns:
    • isId

      boolean isId()
      Indicates whether this field is an id or not. It's used in server mode to add the javax.persistence annotations for the id fields. Default value is false. This field is set to true for GraphQL fields which are of 'ID' type.
    • getInputParameters

      List<Field> getInputParameters()
      All fields in an object may have parameters. A parameter is actually a field.
    • getDataFetcher

      DataFetcher getDataFetcher()
      Returns the data fetcher associated to this field, or null if this field has no data fetcher
    • getDefaultValue

      graphql.language.Value<?> getDefaultValue()
      Contains the default value.. Only used if this field is an input parameter. For enums, it contains the label of the enum, not the value of the enum.
      We store the graphql.language.Value as we receive it. We may not have parsed the relevant Object to check its field, and obviously, we can"t instanciate any object or enum yet, as we dont't even generated any code.
    • getDefaultValueAsText

      default String getDefaultValueAsText()
      Returns the default value, as text, as it can be written into a generated GraphQL schema.
      A str string default value will be returned as "str",a JEDI enum value will be returned as JEDI, ...
      Returns:
    • getRelation

      Relation getRelation()
      Returns the Relation description for this field.
      Returns:
      null if this field is not a relation to another Entity
    • getAnnotation

      String getAnnotation()
      Retrieves the annotation or annotations to add to this field, when in server mode, to serve the relation that this field holds
      Returns:
      The relevant annotation(s) ready to add directly as-is in the Velocity template, or "" (an empty string) if there is no annotation to add. The return is never null.
    • getComments

      List<String> getComments()
      Returns the comments that have been found before this object, in the provided GraphQL schema
    • getDescription

      Description getDescription()
      Returns the description for this object, in the provided GraphQL schema
    • getPascalCaseName

      String getPascalCaseName()
      Convert the given name, which is supposed to be in camel case (for instance: thisIsCamelCase) to a pascal case string (for instance: ThisIsCamelCase).
      Returns:
    • getCamelCaseName

      default String getCamelCaseName()
      Convert the given name, which can be in non camel case (for instance: ThisIsCamelCase) to a pascal case string (for instance: thisIsCamelCase).
      Returns:
    • getAppliedDirectives

      List<AppliedDirective> getAppliedDirectives()
      Returns the list of directives that have been defined for this field, in the GraphQL schema