Class ExecutableNormalizedOperationToAstCompiler
- java.lang.Object
-
- graphql.normalized.ExecutableNormalizedOperationToAstCompiler
-
@PublicApi public class ExecutableNormalizedOperationToAstCompiler extends java.lang.Object
This class can take a list ofExecutableNormalizedFields and compiling out a normalised operationDocumentthat would represent how those fields may be executed.This is essentially the reverse of
ExecutableNormalizedOperationFactorywhich takes operation text and makesExecutableNormalizedFields from it, this takesExecutableNormalizedFields and makes operation text from it.You could for example send that operation text onto to some other graphql server if it has the same schema as the one provided.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExecutableNormalizedOperationToAstCompiler.CompilerResultThe result is aDocumentand a map of variables that would go with that document.
-
Constructor Summary
Constructors Constructor Description ExecutableNormalizedOperationToAstCompiler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ExecutableNormalizedOperationToAstCompiler.CompilerResultcompileToDocument(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @NonNull java.util.Map<ExecutableNormalizedField,QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate)This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFieldsstatic ExecutableNormalizedOperationToAstCompiler.CompilerResultcompileToDocument(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate)This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFieldsstatic ExecutableNormalizedOperationToAstCompiler.CompilerResultcompileToDocumentWithDeferSupport(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @NonNull java.util.Map<ExecutableNormalizedField,QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate)This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFields, with support for the experimental @defer directive.static ExecutableNormalizedOperationToAstCompiler.CompilerResultcompileToDocumentWithDeferSupport(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate)This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFields, with support for the experimental @defer directive.
-
-
-
Method Detail
-
compileToDocument
public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocument(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate)
This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFieldsThe
VariablePredicateis used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema- the graphql schema to useoperationKind- the kind of operationoperationName- the name of the operation to usetopLevelFields- the top levelExecutableNormalizedFields to start fromvariablePredicate- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResultobject
-
compileToDocument
public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocument(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @NonNull java.util.Map<ExecutableNormalizedField,QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate)
This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFieldsThe
VariablePredicateis used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema- the graphql schema to useoperationKind- the kind of operationoperationName- the name of the operation to usetopLevelFields- the top levelExecutableNormalizedFields to start fromnormalizedFieldToQueryDirectives- the map of normalized field to query directivesvariablePredicate- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResultobject
-
compileToDocumentWithDeferSupport
@ExperimentalApi public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocumentWithDeferSupport(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @Nullable VariablePredicate variablePredicate)
This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFields, with support for the experimental @defer directive.The
VariablePredicateis used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema- the graphql schema to useoperationKind- the kind of operationoperationName- the name of the operation to usetopLevelFields- the top levelExecutableNormalizedFields to start fromvariablePredicate- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResultobject - See Also:
compileToDocument(GraphQLSchema, OperationDefinition.Operation, String, List, VariablePredicate)
-
compileToDocumentWithDeferSupport
@ExperimentalApi public static ExecutableNormalizedOperationToAstCompiler.CompilerResult compileToDocumentWithDeferSupport(@NonNull GraphQLSchema schema, @NonNull OperationDefinition.Operation operationKind, @Nullable java.lang.String operationName, @NonNull java.util.List<ExecutableNormalizedField> topLevelFields, @NonNull java.util.Map<ExecutableNormalizedField,QueryDirectives> normalizedFieldToQueryDirectives, @Nullable VariablePredicate variablePredicate)
This will compile an operation textDocumentwith possibly variables from the givenExecutableNormalizedFields, with support for the experimental @defer directive.The
VariablePredicateis used called to decide if the given argument values should be made into a variable OR inlined into the operation text as a graphql literal.- Parameters:
schema- the graphql schema to useoperationKind- the kind of operationoperationName- the name of the operation to usetopLevelFields- the top levelExecutableNormalizedFields to start fromnormalizedFieldToQueryDirectives- the map of normalized field to query directivesvariablePredicate- the variable predicate that decides if arguments turn into variables or not during compilation- Returns:
- a
ExecutableNormalizedOperationToAstCompiler.CompilerResultobject - See Also:
compileToDocument(GraphQLSchema, OperationDefinition.Operation, String, List, Map, VariablePredicate)
-
-