Class GraphqlBooleanCoercing
- java.lang.Object
-
- graphql.scalar.GraphqlBooleanCoercing
-
- All Implemented Interfaces:
Coercing<java.lang.Boolean,java.lang.Boolean>
public class GraphqlBooleanCoercing extends java.lang.Object implements Coercing<java.lang.Boolean,java.lang.Boolean>
The deprecated methods still have implementations in case code outside graphql-java is calling them but internally the call paths have been replaced.
-
-
Constructor Summary
Constructors Constructor Description GraphqlBooleanCoercing()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description @Nullable java.lang.Boolean
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.Boolean
parseLiteral(@NotNull java.lang.Object input)
Deprecated.java.lang.Boolean
parseValue(@NotNull java.lang.Object input)
Deprecated.java.lang.Boolean
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.Boolean
serialize(@NotNull java.lang.Object dataFetcherResult)
Deprecated.@Nullable java.lang.Boolean
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).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface graphql.schema.Coercing
parseLiteral
-
-
-
-
Method Detail
-
serialize
@Deprecated public java.lang.Boolean serialize(@NotNull @NotNull java.lang.Object dataFetcherResult)
Deprecated.Description copied from interface:Coercing
This is deprecated and you should implementCoercing.serialize(Object, GraphQLContext, Locale)
insteadCalled to convert a Java object result of a DataFetcher to a valid runtime value for the scalar type.
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 asCoercingSerializeException
instead as per the method contract.
-
serialize
@Nullable public @Nullable java.lang.Boolean serialize(@NotNull @NotNull java.lang.Object dataFetcherResult, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale) throws CoercingSerializeException
Description copied from interface:Coercing
Called to convert a Java object result of a DataFetcher to a valid runtime value for the scalar type.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 asCoercingSerializeException
instead as per the method contract.- Specified by:
serialize
in interfaceCoercing<java.lang.Boolean,java.lang.Boolean>
- Parameters:
dataFetcherResult
- is never nullgraphQLContext
- the graphql context in placelocale
- the locale to use- Returns:
- a serialized value which may be null.
- Throws:
CoercingSerializeException
- if value input can't be serialized
-
parseValue
@Deprecated public java.lang.Boolean parseValue(@NotNull @NotNull java.lang.Object input)
Deprecated.Description copied from interface:Coercing
This is deprecated and you should implementCoercing.parseValue(Object, GraphQLContext, Locale)
insteadCalled to resolve an input from a query variable into a Java object acceptable for the scalar type.
Note : You should not allow
RuntimeException
s to come out of your parseValue method, but rather catch them and fire them asCoercingParseValueException
instead as per the method contract.Note : if input is explicit/raw value null, input coercion will return null before this method is called
- Specified by:
parseValue
in interfaceCoercing<java.lang.Boolean,java.lang.Boolean>
- Parameters:
input
- is never null- Returns:
- a parsed value which may be null
-
parseValue
public java.lang.Boolean parseValue(@NotNull @NotNull java.lang.Object input, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale) throws CoercingParseValueException
Description copied from interface:Coercing
Called to resolve an input from a query variable into a Java object acceptable for the scalar type.Note : You should not allow
RuntimeException
s to come out of your parseValue method, but rather catch them and fire them asCoercingParseValueException
instead as per the method contract. Note : if input is explicit/raw value null, input coercion will return null before this method is called- Specified by:
parseValue
in interfaceCoercing<java.lang.Boolean,java.lang.Boolean>
- Parameters:
input
- is never nullgraphQLContext
- the graphql context in placelocale
- the locale to use- Returns:
- a parsed value which may be null
- Throws:
CoercingParseValueException
- if value input can't be parsed
-
parseLiteral
@Deprecated public java.lang.Boolean parseLiteral(@NotNull @NotNull java.lang.Object input)
Deprecated.Description copied from interface:Coercing
This is deprecated and you should implementCoercing.parseLiteral(Value, CoercedVariables, GraphQLContext, Locale)
insteadCalled during query validation to convert a query input AST node into a Java object acceptable for the scalar type. The input object will be an instance of
Value
.Note : You should not allow
RuntimeException
s to come out of your parseLiteral method, but rather catch them and fire them asCoercingParseLiteralException
instead as per the method contract.Note : if input is literal
NullValue
, input coercion will return null before this method is called- Specified by:
parseLiteral
in interfaceCoercing<java.lang.Boolean,java.lang.Boolean>
- Parameters:
input
- is never null- Returns:
- a parsed value which may be null
-
parseLiteral
@Nullable public @Nullable java.lang.Boolean parseLiteral(@NotNull @NotNull Value<?> input, @NotNull @NotNull CoercedVariables variables, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale) throws CoercingParseLiteralException
Description copied from interface:Coercing
Called during query execution to convert a query input AST node into a Java object acceptable for the scalar type. The input object will be an instance ofValue
.Note : You should not allow
RuntimeException
s to come out of your parseLiteral method, but rather catch them and fire them asCoercingParseLiteralException
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 literalNullValue
, input coercion will return null before this method is called- Specified by:
parseLiteral
in interfaceCoercing<java.lang.Boolean,java.lang.Boolean>
- Parameters:
input
- is never nullvariables
- the resolved variables passed to the querygraphQLContext
- the graphql context in placelocale
- the locale to use- Returns:
- a parsed value which may be null
- Throws:
CoercingParseLiteralException
- if input literal can't be parsed
-
valueToLiteral
@Deprecated public Value valueToLiteral(@NotNull @NotNull java.lang.Object input)
Deprecated.Description copied from interface:Coercing
This is deprecated and you should implementCoercing.valueToLiteral(Object, GraphQLContext, Locale)
insteadConverts an external input value to a literal (Ast Value).
IMPORTANT: the argument is validated before by calling
Coercing.parseValue(Object)
.- Specified by:
valueToLiteral
in interfaceCoercing<java.lang.Boolean,java.lang.Boolean>
- Parameters:
input
- an external input value- Returns:
- The literal matching the external input value.
-
valueToLiteral
@NotNull public @NotNull Value<?> valueToLiteral(@NotNull @NotNull java.lang.Object input, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull java.util.Locale locale)
Description copied from interface:Coercing
Converts an external input value to a literal (Ast Value).IMPORTANT: the argument is validated before by calling
Coercing.parseValue(Object)
.- Specified by:
valueToLiteral
in interfaceCoercing<java.lang.Boolean,java.lang.Boolean>
- Parameters:
input
- an external input valuegraphQLContext
- the graphql context in placelocale
- the locale to use- Returns:
- The literal matching the external input value.
-
-