@PublicApi public interface ArgumentConverter
GraphQLArgument
value into some other
object representation such as a POJO. This allows later DataFetcher
code to assume a specific
argument object shape.
By default graphql will receive a complex GraphQLInputObjectType
as a map of values. You can use
this interface to convert this into a type safe POJO say which will then be passed onto DataFetcher code.
Uou might use your favourite object mapping framework for conversion such as Jackson or GSON, graphql-java doesnt care, it only cares that you
take a basic object and give back the converted one for use further down the execution
The inputs you will receive as as follows :
Coercing
functions. This interface
is most powerful when you have GraphQLInputObjectType
types as argument values.Modifier and Type | Method and Description |
---|---|
java.lang.Object |
convertArgument(ArgumentConverterEnvironment environment)
This is called with the object to convert and extra type information about tbe argument being converted.
|
java.lang.Object convertArgument(ArgumentConverterEnvironment environment)
ArgumentConverterEnvironment.getValueToBeConverted()
so another converter in the chain may have a go.environment
- the conversion environmentArgumentConverterEnvironment.getValueToBeConverted()
if you don't want to convert it