Class GraphQlArgumentBinder

java.lang.Object
org.springframework.graphql.data.GraphQlArgumentBinder

public class GraphQlArgumentBinder extends Object
Binder that instantiates and populates a target Object to reflect the complete structure of the GraphQL arguments input map.

The input map is navigated recursively to create the full structure of the target type. Objects in the target type are created either through a primary, data constructor, in which case arguments are matched to constructor parameters by name, or through the default constructor, in which case arguments are matched to properties. Scalar values are converted, if necessary, through a ConversionService.

The binder does not stop at the first error, but rather accumulates as many errors as it can in a BindingResult. At the end it raises a BindException that contains all recorded errors along with the path at which each error occurred.

The binder supports Optional as a wrapper around any Object or scalar value in the target Object structure. In addition, it also supports ArgumentValue as a wrapper that indicates whether a given input argument was omitted rather than set to the "null" literal.

Since:
1.0.0
Author:
Brian Clozel, Rossen Stoyanchev
  • Constructor Details

    • GraphQlArgumentBinder

      public GraphQlArgumentBinder()
    • GraphQlArgumentBinder

      public GraphQlArgumentBinder(@Nullable ConversionService conversionService)
    • GraphQlArgumentBinder

      public GraphQlArgumentBinder(@Nullable ConversionService conversionService, boolean fallBackOnDirectFieldAccess)
  • Method Details