Class GraphqlFloatCoercing
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable DoubleparseLiteral(@NonNull Value<?> input, @NonNull CoercedVariables variables, @NonNull GraphQLContext graphQLContext, @NonNull Locale locale) Called during query execution to convert a query input AST node into a Java object acceptable for the scalar type.parseLiteral(@NonNull Object input) Deprecated.@NonNull DoubleparseValue(@NonNull Object input) Deprecated.parseValue(@NonNull Object input, @NonNull GraphQLContext graphQLContext, @NonNull Locale locale) Called to resolve an input from a query variable into a Java object acceptable for the scalar type.Deprecated.@Nullable Doubleserialize(@NonNull Object dataFetcherResult, @NonNull GraphQLContext graphQLContext, @NonNull Locale locale) Called to convert a Java object result of a DataFetcher to a valid runtime value for the scalar type.valueToLiteral(@NonNull Object input) Deprecated.@NonNull Value<?> valueToLiteral(@NonNull Object input, @NonNull GraphQLContext graphQLContext, @NonNull 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, waitMethods inherited from interface graphql.schema.Coercing
parseLiteral
-
Constructor Details
-
GraphqlFloatCoercing
public GraphqlFloatCoercing()
-
-
Method Details
-
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
public @Nullable Double serialize(@NonNull Object dataFetcherResult, @NonNull GraphQLContext graphQLContext, @NonNull 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<Double,Double> - 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<Double,Double> - Parameters:
input- is never null- Returns:
- a parsed value which may be null
-
parseValue
public Double parseValue(@NonNull Object input, @NonNull GraphQLContext graphQLContext, @NonNull 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<Double,Double> - 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<Double,Double> - Parameters:
input- is never null- Returns:
- a parsed value which may be null
-
parseLiteral
public @Nullable Double parseLiteral(@NonNull Value<?> input, @NonNull CoercedVariables variables, @NonNull GraphQLContext graphQLContext, @NonNull 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<Double,Double> - 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<Double,Double> - Parameters:
input- an external input value- Returns:
- The literal matching the external input value.
-
valueToLiteral
public @NonNull Value<?> valueToLiteral(@NonNull Object input, @NonNull GraphQLContext graphQLContext, @NonNull 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<Double,Double> - Parameters:
input- an external input valuegraphQLContext- the graphql context in placelocale- the locale to use- Returns:
- The literal matching the external input value.
-