public class AstValueHelper
extends java.lang.Object
| Constructor and Description |
|---|
AstValueHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Value<?> |
astFromValue(java.lang.Object value,
GraphQLType type)
Produces a GraphQL Value AST given a Java value.
|
static Value<?> |
valueFromAst(java.lang.String astLiteral)
Parses an AST value literal into the correct
Value which
MUST be of the correct shape eg '"string"' or 'true' or '1' or '{ "object", "form" }'
or '[ "array", "form" ]' otherwise an exception is thrown |
public static Value<?> astFromValue(java.lang.Object value, GraphQLType type)
A GraphQL type must be provided, which will be used to interpret different Java values.
| Value | GraphQL Value | | ------------- | -------------------- | | Object | Input Object | | Array | List | | Boolean | Boolean | | String | String / Enum Value | | Number | Int / Float | | Mixed | Enum Value |
value - - the java value to be converted into graphql asttype - the graphql type of the objectValuepublic static Value<?> valueFromAst(java.lang.String astLiteral)
Value which
MUST be of the correct shape eg '"string"' or 'true' or '1' or '{ "object", "form" }'
or '[ "array", "form" ]' otherwise an exception is thrownastLiteral - the string to parse an AST literalAssertException - if the input can be parsed