Package no.sikt.graphql.directives
Class DirectiveHelpers
java.lang.Object
no.sikt.graphql.directives.DirectiveHelpers
Helper methods for extracting directive information from the schema.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BooleangetDirectiveArgumentBoolean(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value.static StringgetDirectiveArgumentEnum(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value.static List<graphql.language.ObjectField>getDirectiveArgumentObjectFields(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value.static StringgetDirectiveArgumentString(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value.static <T extends graphql.language.NamedNode<T>>
TgetObjectFieldByName(List<T> fields, no.sikt.graphql.directives.GenerationDirectiveParam param) getOptionalDirectiveArgumentBoolean(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) getOptionalDirectiveArgumentEnum(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) getOptionalDirectiveArgumentObjectFields(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) getOptionalDirectiveArgumentString(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) getOptionalDirectiveArgumentStringList(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) static <T extends graphql.language.NamedNode<T>>
Optional<T>getOptionalObjectFieldByName(List<T> fields, no.sikt.graphql.directives.GenerationDirectiveParam param) getRepeatableDirectiveArgumentString(graphql.language.DirectivesContainer<?> container, String directive, String param) static StringstringValueOf(graphql.language.ObjectField objectField)
-
Constructor Details
-
DirectiveHelpers
public DirectiveHelpers()
-
-
Method Details
-
getOptionalDirectiveArgumentString
public static Optional<String> getOptionalDirectiveArgumentString(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) - Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- The String value of the directive argument, if it exists.
-
getRepeatableDirectiveArgumentString
public static List<String> getRepeatableDirectiveArgumentString(graphql.language.DirectivesContainer<?> container, String directive, String param) - Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- The String values of the directive arguments, if they exist.
-
getOptionalDirectiveArgumentEnum
public static Optional<String> getOptionalDirectiveArgumentEnum(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) - Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- The name of the enum value for this argument, if it exists.
-
getOptionalDirectiveArgumentStringList
public static List<String> getOptionalDirectiveArgumentStringList(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) - Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- List of String values of the directive argument, if it exists.
-
getOptionalDirectiveArgumentBoolean
public static Optional<Boolean> getOptionalDirectiveArgumentBoolean(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) - Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- The Boolean value of the directive argument, if it exists.
-
getOptionalDirectiveArgumentObjectFields
public static Optional<List<graphql.language.ObjectField>> getOptionalDirectiveArgumentObjectFields(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) - Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- Object fields of the directive argument, if it exists.
-
getDirectiveArgumentString
public static String getDirectiveArgumentString(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value. This assumes that the argument is required and will exist.- Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- The String value of the directive argument. An exception is thrown if this does not exist.
-
getDirectiveArgumentEnum
public static String getDirectiveArgumentEnum(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value. This assumes that the argument is required and will exist.- Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- The name of the enum value for this argument. An exception is thrown if this does not exist.
-
getDirectiveArgumentBoolean
public static Boolean getDirectiveArgumentBoolean(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value. This assumes that the argument is required and will exist.- Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- The Boolean value of the directive argument. An exception is thrown if this does not exist.
-
getDirectiveArgumentObjectFields
public static List<graphql.language.ObjectField> getDirectiveArgumentObjectFields(graphql.language.DirectivesContainer<?> container, no.sikt.graphql.directives.GenerationDirective directive, no.sikt.graphql.directives.GenerationDirectiveParam param) Get a directive argument value. This assumes that the argument is required and will exist.- Parameters:
container- The graph element to be inspected.directive- The directive this argument should be set on.param- Name of the argument.- Returns:
- Object fields of the directive argument. An exception is thrown if this does not exist.
-
getOptionalObjectFieldByName
-
getObjectFieldByName
public static <T extends graphql.language.NamedNode<T>> T getObjectFieldByName(List<T> fields, no.sikt.graphql.directives.GenerationDirectiveParam param) -
stringValueOf
-