Class FieldTypeAST

java.lang.Object
com.graphql_java_generator.plugin.language.FieldTypeAST

public class FieldTypeAST extends Object
This class is a transcription of the GraphQL type of a field, as it has been read in the AST. When browsing through the GraphQL AST, the type may not already have been parsed. This can occur when a field F1 of the type T1 refers to the T2 type, while the T2 type contains a F2 field, that is of the T1 type.
So, when reading the AST, we only store the type name, if it's mandatory and its structure (if it's a list, a list of list...). When generating the code, the whole AST has been read. At this moment, it's possible to access to the instance of the Type for this type, and read all its properties (java class...)
Author:
etienne-sf
  • Constructor Details

    • FieldTypeAST

      public FieldTypeAST()
      The default constructor
    • FieldTypeAST

      public FieldTypeAST(String graphQLTypeName)
      The standard constructor
  • Method Details

    • getJavaType

      public String getJavaType(String classSimpleName)
      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.
      The aim of this recursive method is to manage list of list of list of list...
    • getGraphQLType

      public 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!]!]!
    • getGraphQLTypeSimpleName

      public String getGraphQLTypeSimpleName()
    • setGraphQLTypeName

      public void setGraphQLTypeName(String graphQLTypeName)