Class GraphQLGeneratorOptions

java.lang.Object
org.brapi.schematools.core.options.AbstractGeneratorOptions
org.brapi.schematools.core.graphql.options.GraphQLGeneratorOptions
All Implemented Interfaces:
Options, Validatable

public class GraphQLGeneratorOptions extends AbstractGeneratorOptions
Options for the GraphQLGenerator.
  • Constructor Details

    • GraphQLGeneratorOptions

      public GraphQLGeneratorOptions()
  • Method Details

    • load

      public static GraphQLGeneratorOptions load()
      Load the default options
      Returns:
      The default options
    • load

      public static GraphQLGeneratorOptions load(Path optionsFile) throws IOException
      Load the options from an options file in YAML or Json. The options file may have missing (defined) values, in these cases the default values are loaded. See load()
      Parameters:
      optionsFile - The path to the options file in YAML or Json.
      Returns:
      The options loaded from the YAML or Json file.
      Throws:
      IOException - if the options file can not be found or is incorrectly formatted.
    • load

      public static GraphQLGeneratorOptions load(InputStream inputStream) throws IOException
      Load the options from an options input stream in YAML or Json. The options file may have missing (defined) values, in these cases the default values are loaded. See load()
      Parameters:
      inputStream - The input stream in YAML or Json.
      Returns:
      The options loaded from input stream.
      Throws:
      IOException - if the input stream is not valid or the content is incorrectly formatted.
    • validate

      public Validation validate()
      Description copied from interface: Validatable
      Checks if the Validatable object is valid, return a list of errors if it is not valid
      Returns:
      a Validation object than can be used queried to find if the object is valid and any errors if it is not valid
    • override

      public GraphQLGeneratorOptions override(GraphQLGeneratorOptions overrideOptions)
      Overrides the values in this Options Object from the provided Options Object if they are non-null
      Parameters:
      overrideOptions - the options which will be used to override this Options Object
      Returns:
      this options for method chaining
    • isGeneratingQueryType

      public boolean isGeneratingQueryType()
      Determines if the Generator should generate the Query Type.
      Returns:
      true if the Generator should generate the Query Type, false otherwise
    • isGeneratingSingleQueries

      public boolean isGeneratingSingleQueries()
      Determines if the Generator should generate any single query. Returns true if AbstractGeneratorSubOptions.isGenerating() is set to true or
      Returns:
      true if the Generator should generate any single query, false otherwise
    • isGeneratingSingleQueryFor

      public boolean isGeneratingSingleQueryFor(String name)
      Determines if the Generator should generate the single query for a specific Primary Model. Returns true if AbstractGeneratorSubOptions.isGeneratingFor(String) is set to true for the specified type
      Parameters:
      name - the name of the Primary Model
      Returns:
      true if the Generator should generate single query for a specific Primary Model, false otherwise
    • isGeneratingListQueries

      public boolean isGeneratingListQueries()
      Determines if the Generator should generate any List Query. Returns true if AbstractGeneratorSubOptions.isGenerating() is set to true for any type
      Returns:
      true if the Generator should generate any List Query, false otherwise
    • isGeneratingListQueryFor

      public boolean isGeneratingListQueryFor(String name)
      Determines if the Generator should generate the List Query for a specific Primary Model. Returns true if AbstractGeneratorSubOptions.isGeneratingFor(String) is set to true for the specified type
      Parameters:
      name - the name of the Primary Model
      Returns:
      true if the Generator should generate List Query for a specific Primary Model, false otherwise
    • isGeneratingSearchQueries

      public boolean isGeneratingSearchQueries()
      Determines if the Generator should generate any Search Query. Returns true if AbstractGeneratorSubOptions.isGenerating() is set to true
      Returns:
      true if the Generator should generate any Search Query, false otherwise
    • isGeneratingSearchQueryFor

      public boolean isGeneratingSearchQueryFor(String name)
      Determines if the Generator should generate the Search Query for a specific Primary Model. Returns true if AbstractGeneratorSubOptions.isGeneratingFor(String) is set to true for the specified type
      Parameters:
      name - the name of the Primary Model
      Returns:
      true if the Generator should generate Search Query for a specific Primary Model, false otherwise
    • isGeneratingMutationType

      public boolean isGeneratingMutationType()
      Determines if the Generator should generate the Mutation Type.
      Returns:
      true if the Generator should generate the Mutation Type, false otherwise
    • isGeneratingCreateMutation

      public boolean isGeneratingCreateMutation()
      Determines if the Generator should generate the New mutations. Returns true if AbstractGeneratorSubOptions.isGenerating() is set to true
      Returns:
      true if the Generator should generate New mutations, false otherwise
    • isGeneratingCreateMutationFor

      public boolean isGeneratingCreateMutationFor(String name)
      Determines if the Generator should generate the New mutation for a specific Primary Model. Returns true if AbstractGeneratorSubOptions.isGeneratingFor(String) is set to true for the specified type
      Parameters:
      name - the name of the Primary Model
      Returns:
      true if the Generator should generate Create mutation for a specific Primary Model, false otherwise
    • isGeneratingUpdateMutation

      public boolean isGeneratingUpdateMutation()
      Determines if the Generator should generate the Update mutations. Returns true if AbstractGeneratorSubOptions.isGenerating() is set to true
      Returns:
      true if the Generator should generate Update mutations, false otherwise
    • isGeneratingUpdateMutationFor

      public boolean isGeneratingUpdateMutationFor(String name)
      Determines if the Generator should generate the Update mutation for a specific Primary Model. Returns true if AbstractGeneratorSubOptions.isGeneratingFor(String) is set to true or the specified type
      Parameters:
      name - the name of the Primary Model
      Returns:
      true if the Generator should generate Update mutation for a specific Primary Model, false otherwise
    • isGeneratingDeleteMutation

      public boolean isGeneratingDeleteMutation()
      Determines if the Generator should generate the Delete mutations. Returns true if AbstractGeneratorSubOptions.isGenerating() is set to true or
      Returns:
      true if the Generator should generate Delete mutations, false otherwise
    • isGeneratingDeleteMutationFor

      public boolean isGeneratingDeleteMutationFor(String name)
      Determines if the Generator should generate the Delete mutation for a specific Primary Model. Returns true if AbstractGeneratorSubOptions.isGeneratingFor(String) is set to true for the specified type
      Parameters:
      name - the name of the Primary Model
      Returns:
      true if the Generator should generate Delete mutation for a specific Primary Model, false otherwise
    • isUsingIDType

      public boolean isUsingIDType()
      Determines if the built-in GraphQLID type should be used for IDs instead of GraphQLString
      Returns:
      true if the built-in GraphQLID type should be used for IDs instead of GraphQLString, false otherwise
    • getQueryInputParameterNameFor

      public final String getQueryInputParameterNameFor(@NonNull @NonNull String name)
      Gets the name of the List or Search Query input parameter for of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the List or Search Query input parameter for of specific primary model
    • getQueryInputParameterNameFor

      public final String getQueryInputParameterNameFor(@NonNull @NonNull BrAPIType type)
      Gets the name of the List or Search Query input parameter for of specific primary model
      Parameters:
      type - the primary model
      Returns:
      the name of the List or Search Query input parameter for of specific primary model
    • getQueryInputTypeNameFor

      public final String getQueryInputTypeNameFor(@NonNull @NonNull String name)
      Gets the name of the List or Search Query input type for of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the List or Search input type for of specific primary model
    • getQueryInputTypeNameFor

      public final String getQueryInputTypeNameFor(@NonNull @NonNull BrAPIType type)
      Gets the name of the List or Search Query input type for of specific primary model
      Parameters:
      type - the primary model
      Returns:
      the name of the List or Search input type for of specific primary model
    • getSingleQueryNameFor

      public String getSingleQueryNameFor(String name)
      Gets the name of the Single Query of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the Single Query of specific primary model
    • getListQueryNameFor

      public String getListQueryNameFor(String name)
      Gets the name of the List Query of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the List Query of specific primary model
    • getSearchQueryNameFor

      public String getSearchQueryNameFor(String name)
      Gets the name of the Search Query of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the Search Query of specific primary model
    • getCreateMutationNameFor

      public String getCreateMutationNameFor(String name)
      Gets the name of the Create Mutation of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the Create Mutation of specific primary model
    • getUpdateMutationNameFor

      public String getUpdateMutationNameFor(String name)
      Gets the name of the Update Mutation of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the Update Mutation of specific primary model
    • getDeleteMutationNameFor

      public String getDeleteMutationNameFor(String name)
      Gets the name of the Delete Mutation of specific primary model
      Parameters:
      name - the name of the primary model
      Returns:
      the name of the Delete Mutation of specific primary model
    • isMergingOneOfType

      public boolean isMergingOneOfType(BrAPIClass type)
      Gets if the possible types of a 'OneOf' type are merged into a single type.
      Parameters:
      type - the BrAPIClass
      Returns:
      true if the possible types of a 'OneOf' type are merged into a single type.
    • setMergeOneOfType

      public final GraphQLGeneratorOptions setMergeOneOfType(String name, boolean isMergingOneOfType)
      Sets if the possible types of a 'OneOf' type are merged into a single type.
      Parameters:
      name - the name of the type
      isMergingOneOfType - true if the possible types of a 'OneOf' type are merged into a single type, false otherwise
      Returns:
      the options for chaining