Class GraphqlBooleanCoercing
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate BooleanconvertImpl(Object input) @Nullable BooleanparseLiteral(@NotNull Value<?> input, @NotNull CoercedVariables variables, @NotNull GraphQLContext graphQLContext, @NotNull Locale locale) Called during query execution to convert a query input AST node into a Java object acceptable for the scalar type.parseLiteral(@NotNull Object input) Deprecated.private static booleanparseLiteralImpl(@NotNull Object input, @NotNull Locale locale) parseValue(@NotNull Object input) Deprecated.parseValue(@NotNull Object input, @NotNull GraphQLContext graphQLContext, @NotNull Locale locale) Called to resolve an input from a query variable into a Java object acceptable for the scalar type.private @NotNull BooleanparseValueImpl(@NotNull Object input, @NotNull Locale locale) Deprecated.@Nullable Booleanserialize(@NotNull Object dataFetcherResult, @NotNull GraphQLContext graphQLContext, @NotNull Locale locale) Called to convert a Java object result of a DataFetcher to a valid runtime value for the scalar type.private @NotNull BooleanserializeImpl(@NotNull Object input, @NotNull Locale locale) valueToLiteral(@NotNull Object input) Deprecated.@NotNull Value<?> valueToLiteral(@NotNull Object input, @NotNull GraphQLContext graphQLContext, @NotNull Locale locale) Converts an external input value to a literal (Ast Value).private @NotNull BooleanValuevalueToLiteralImpl(@NotNull Object input, @NotNull Locale locale) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Coercing
parseLiteral
-
Constructor Details
-
GraphqlBooleanCoercing
public GraphqlBooleanCoercing()
-
-
Method Details
-
convertImpl
-
serializeImpl
-
parseValueImpl
-
parseLiteralImpl
-
valueToLiteralImpl
@NotNull private @NotNull BooleanValue valueToLiteralImpl(@NotNull @NotNull Object input, @NotNull @NotNull Locale locale) -
serialize
Deprecated.Description copied from interface:CoercingThis 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
CoercingSerializeExceptionif there is fundamental problem during serialization, don't return null to indicate failure.Note : You should not allow
RuntimeExceptions to come out of your serialize method, but rather catch them and fire them asCoercingSerializeExceptioninstead as per the method contract. -
serialize
@Nullable public @Nullable Boolean serialize(@NotNull @NotNull Object dataFetcherResult, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull Locale locale) throws CoercingSerializeException Description copied from interface:CoercingCalled to convert a Java object result of a DataFetcher to a valid runtime value for the scalar type.Note : Throw
CoercingSerializeExceptionif there is fundamental problem during serialization, don't return null to indicate failure.Note : You should not allow
RuntimeExceptions to come out of your serialize method, but rather catch them and fire them asCoercingSerializeExceptioninstead as per the method contract.- Specified by:
serializein interfaceCoercing<Boolean,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.Description copied from interface:CoercingThis 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
RuntimeExceptions to come out of your parseValue method, but rather catch them and fire them asCoercingParseValueExceptioninstead 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:
parseValuein interfaceCoercing<Boolean,Boolean> - Parameters:
input- is never null- Returns:
- a parsed value which may be null
-
parseValue
public Boolean parseValue(@NotNull @NotNull Object input, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull Locale locale) throws CoercingParseValueException Description copied from interface:CoercingCalled to resolve an input from a query variable into a Java object acceptable for the scalar type.Note : You should not allow
RuntimeExceptions to come out of your parseValue method, but rather catch them and fire them asCoercingParseValueExceptioninstead 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:
parseValuein interfaceCoercing<Boolean,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.Description copied from interface:CoercingThis 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
RuntimeExceptions to come out of your parseLiteral method, but rather catch them and fire them asCoercingParseLiteralExceptioninstead as per the method contract.Note : if input is literal
NullValue, input coercion will return null before this method is called- Specified by:
parseLiteralin interfaceCoercing<Boolean,Boolean> - Parameters:
input- is never null- Returns:
- a parsed value which may be null
-
parseLiteral
@Nullable public @Nullable Boolean parseLiteral(@NotNull @NotNull Value<?> input, @NotNull @NotNull CoercedVariables variables, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull Locale locale) throws CoercingParseLiteralException Description copied from interface:CoercingCalled 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
RuntimeExceptions to come out of your parseLiteral method, but rather catch them and fire them asCoercingParseLiteralExceptioninstead as per the method contract.Many scalar types don't need to implement this method because they don't take AST
VariableReferenceobjects 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:
parseLiteralin interfaceCoercing<Boolean,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.Description copied from interface:CoercingThis 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:
valueToLiteralin interfaceCoercing<Boolean,Boolean> - Parameters:
input- an external input value- Returns:
- The literal matching the external input value.
-
valueToLiteral
@NotNull public @NotNull Value<?> valueToLiteral(@NotNull @NotNull Object input, @NotNull @NotNull GraphQLContext graphQLContext, @NotNull @NotNull Locale locale) Description copied from interface:CoercingConverts an external input value to a literal (Ast Value).IMPORTANT: the argument is validated before by calling
Coercing.parseValue(Object).- Specified by:
valueToLiteralin interfaceCoercing<Boolean,Boolean> - Parameters:
input- an external input valuegraphQLContext- the graphql context in placelocale- the locale to use- Returns:
- The literal matching the external input value.
-