public class GraphqlIDCoercing extends java.lang.Object implements Coercing<java.lang.Object,java.lang.Object>
Constructor and Description |
---|
GraphqlIDCoercing() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
parseLiteral(@NotNull java.lang.Object input)
Deprecated.
|
@Nullable java.lang.Object |
parseLiteral(@NotNull Value<?> input,
@NotNull CoercedVariables variables,
@NotNull GraphQLContext graphQLContext,
@NotNull java.util.Locale locale)
Called during query execution to convert a query input AST node into a Java object acceptable for the scalar type.
|
java.lang.String |
parseValue(@NotNull java.lang.Object input)
Deprecated.
|
java.lang.Object |
parseValue(@NotNull java.lang.Object input,
@NotNull GraphQLContext graphQLContext,
@NotNull java.util.Locale locale)
Called to resolve an input from a query variable into a Java object acceptable for the scalar type.
|
java.lang.String |
serialize(@NotNull java.lang.Object dataFetcherResult)
Deprecated.
|
@Nullable java.lang.Object |
serialize(@NotNull java.lang.Object dataFetcherResult,
@NotNull GraphQLContext graphQLContext,
@NotNull java.util.Locale locale)
Called to convert a Java object result of a DataFetcher to a valid runtime value for the scalar type.
|
Value |
valueToLiteral(@NotNull java.lang.Object input)
Deprecated.
|
@NotNull Value<?> |
valueToLiteral(@NotNull java.lang.Object input,
@NotNull GraphQLContext graphQLContext,
@NotNull java.util.Locale locale)
Converts an external input value to a literal (Ast Value).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
parseLiteral
@Deprecated public java.lang.String serialize(@NotNull @NotNull java.lang.Object dataFetcherResult)
Coercing
Note : Throw CoercingSerializeException
if there is fundamental
problem during serialization, don't return null to indicate failure.
Note : You should not allow RuntimeException
s to come out of your serialize method, but rather
catch them and fire them as CoercingSerializeException
instead as per the method contract.
@Nullable public @Nullable java.lang.Object serialize(@NotNull @NotNull java.lang.Object dataFetcherResult, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale) throws CoercingSerializeException
Coercing
Note : Throw CoercingSerializeException
if there is fundamental
problem during serialization, don't return null to indicate failure.
Note : You should not allow RuntimeException
s to come out of your serialize method, but rather
catch them and fire them as CoercingSerializeException
instead as per the method contract.
serialize
in interface Coercing<java.lang.Object,java.lang.Object>
dataFetcherResult
- is never nullgraphQLContext
- the graphql context in placelocale
- the locale to useCoercingSerializeException
- if value input can't be serialized@Deprecated public java.lang.String parseValue(@NotNull @NotNull java.lang.Object input)
Coercing
Note : You should not allow RuntimeException
s to come out of your parseValue method, but rather
catch them and fire them as CoercingParseValueException
instead as per the method contract.
Note : if input is explicit/raw value null, input coercion will return null before this method is called
parseValue
in interface Coercing<java.lang.Object,java.lang.Object>
input
- is never nullpublic java.lang.Object parseValue(@NotNull @NotNull java.lang.Object input, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale) throws CoercingParseValueException
Coercing
Note : You should not allow RuntimeException
s to come out of your parseValue method, but rather
catch them and fire them as CoercingParseValueException
instead as per the method contract.
Note : if input is explicit/raw value null, input coercion will return null before this method is called
parseValue
in interface Coercing<java.lang.Object,java.lang.Object>
input
- is never nullgraphQLContext
- the graphql context in placelocale
- the locale to useCoercingParseValueException
- if value input can't be parsed@Deprecated public java.lang.String parseLiteral(@NotNull @NotNull java.lang.Object input)
Coercing
Value
.
Note : You should not allow RuntimeException
s to come out of your parseLiteral method, but rather
catch them and fire them as CoercingParseLiteralException
instead as per the method contract.
Note : if input is literal NullValue
, input coercion will return null before this method is called
parseLiteral
in interface Coercing<java.lang.Object,java.lang.Object>
input
- is never null@Nullable public @Nullable java.lang.Object parseLiteral(@NotNull @NotNull Value<?> input, @NotNull @NotNull CoercedVariables variables, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale) throws CoercingParseLiteralException
Coercing
Value
.
Note : You should not allow RuntimeException
s to come out of your parseLiteral method, but rather
catch them and fire them as CoercingParseLiteralException
instead as per the method contract.
Many scalar types don't need to implement this method because they don't take AST VariableReference
objects and convert them into actual values. But for those scalar types that want to do this, then this
method should be implemented.
Note : if input is literal NullValue
, input coercion will return null before this method is called
parseLiteral
in interface Coercing<java.lang.Object,java.lang.Object>
input
- is never nullvariables
- the resolved variables passed to the querygraphQLContext
- the graphql context in placelocale
- the locale to useCoercingParseLiteralException
- if input literal can't be parsed@Deprecated public Value valueToLiteral(@NotNull @NotNull java.lang.Object input)
Coercing
IMPORTANT: the argument is validated before by calling Coercing.parseValue(Object)
.
valueToLiteral
in interface Coercing<java.lang.Object,java.lang.Object>
input
- an external input value@NotNull public @NotNull Value<?> valueToLiteral(@NotNull @NotNull java.lang.Object input, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale)
Coercing
IMPORTANT: the argument is validated before by calling Coercing.parseValue(Object)
.
valueToLiteral
in interface Coercing<java.lang.Object,java.lang.Object>
input
- an external input valuegraphQLContext
- the graphql context in placelocale
- the locale to use