public class GraphQlArgumentBinder extends Object
Binding is performed by mapping argument values to a primary data constructor of the target object, or by using a default constructor and mapping argument values to its properties. This is applied recursively.
Constructor and Description |
---|
GraphQlArgumentBinder() |
GraphQlArgumentBinder(ConversionService conversionService) |
Modifier and Type | Method and Description |
---|---|
Object |
bind(DataFetchingEnvironment environment,
String argumentName,
ResolvableType targetType)
Bind a single argument, or the full arguments map, onto an object of the
given target type.
|
public GraphQlArgumentBinder()
public GraphQlArgumentBinder(@Nullable ConversionService conversionService)
@Nullable public Object bind(DataFetchingEnvironment environment, @Nullable String argumentName, ResolvableType targetType) throws BindException
environment
- for access to the argumentsargumentName
- the name of the argument to bind, or null
to
use the full arguments maptargetType
- the type of Object to createnull
BindException
- in case of binding issues such as conversion errors,
mismatches between the source and the target object structure, and so on.
Binding issues are accumulated as field errors
where the field
of each error
is the argument path where the issue occurred.