Fix variable names following recent rename

This commit is contained in:
rstoyanchev
2022-03-22 13:28:20 +00:00
parent 7e43223031
commit fc1e05bbf0
6 changed files with 25 additions and 24 deletions

View File

@@ -48,11 +48,11 @@ import org.springframework.validation.FieldError;
/**
* Bind a GraphQL argument values to higher level objects.
* Bind a GraphQL argument, or the full arguments map, onto a target object.
*
* <p>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 properties. This is applied recursively.
* constructor of the target object, or by using a default constructor and
* mapping argument values to its properties. This is applied recursively.
*
* @author Brian Clozel
* @author Rossen Stoyanchev
@@ -93,9 +93,9 @@ public class GraphQlArgumentBinder {
/**
* Bind a single argument or the full arguments map onto an object of the
* Bind a single argument, or the full arguments map, onto an object of the
* given target type.
* @param environment to obtain the argument value(s) from
* @param environment for access to the arguments
* @param argumentName the name of the argument to bind, or {@code null} to
* use the full arguments map
* @param targetType the type of Object to create
@@ -103,8 +103,8 @@ public class GraphQlArgumentBinder {
* @throws 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 {@link BindException#getFieldErrors()
* field errors} where the {@code field} of each error is the argument path
* where the issue occurred.
* field errors} where the {@link FieldError#getField() field} of each error
* is the argument path where the issue occurred.
*/
@Nullable
@SuppressWarnings("unchecked")

View File

@@ -159,9 +159,9 @@ public class AnnotatedControllerConfigurer
this.argumentResolvers.addResolver(new ProjectedPayloadMethodArgumentResolver(obtainApplicationContext()));
}
this.argumentResolvers.addResolver(new ArgumentMapMethodArgumentResolver());
GraphQlArgumentBinder initializer = new GraphQlArgumentBinder(this.conversionService);
this.argumentResolvers.addResolver(new ArgumentMethodArgumentResolver(initializer));
this.argumentResolvers.addResolver(new ArgumentsMethodArgumentResolver(initializer));
GraphQlArgumentBinder argumentBinder = new GraphQlArgumentBinder(this.conversionService);
this.argumentResolvers.addResolver(new ArgumentMethodArgumentResolver(argumentBinder));
this.argumentResolvers.addResolver(new ArgumentsMethodArgumentResolver(argumentBinder));
this.argumentResolvers.addResolver(new ContextValueMethodArgumentResolver());
// Type based

View File

@@ -37,12 +37,12 @@ import org.springframework.util.StringUtils;
*/
public class ArgumentMethodArgumentResolver implements HandlerMethodArgumentResolver {
private final GraphQlArgumentBinder argumentInitializer;
private final GraphQlArgumentBinder argumentBinder;
public ArgumentMethodArgumentResolver(GraphQlArgumentBinder initializer) {
Assert.notNull(initializer, "GraphQlArgumentInitializer is required");
this.argumentInitializer = initializer;
public ArgumentMethodArgumentResolver(GraphQlArgumentBinder argumentBinder) {
Assert.notNull(argumentBinder, "GraphQlArgumentBinder is required");
this.argumentBinder = argumentBinder;
}
@@ -55,7 +55,7 @@ public class ArgumentMethodArgumentResolver implements HandlerMethodArgumentReso
public Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment) throws Exception {
String name = getArgumentName(parameter);
ResolvableType resolvableType = ResolvableType.forMethodParameter(parameter);
return this.argumentInitializer.bind(environment, name, resolvableType);
return this.argumentBinder.bind(environment, name, resolvableType);
}
static String getArgumentName(MethodParameter parameter) {

View File

@@ -34,12 +34,12 @@ import org.springframework.util.Assert;
*/
public class ArgumentsMethodArgumentResolver implements HandlerMethodArgumentResolver {
private final GraphQlArgumentBinder argumentInitializer;
private final GraphQlArgumentBinder argumentBinder;
public ArgumentsMethodArgumentResolver(GraphQlArgumentBinder initializer) {
Assert.notNull(initializer, "GraphQlArgumentInitializer is required");
this.argumentInitializer = initializer;
public ArgumentsMethodArgumentResolver(GraphQlArgumentBinder argumentBinder) {
Assert.notNull(argumentBinder, "GraphQlArgumentBinder is required");
this.argumentBinder = argumentBinder;
}
@@ -51,7 +51,7 @@ public class ArgumentsMethodArgumentResolver implements HandlerMethodArgumentRes
@Override
public Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment) throws Exception {
ResolvableType resolvableType = ResolvableType.forMethodParameter(parameter);
return this.argumentInitializer.bind(environment, null, resolvableType);
return this.argumentBinder.bind(environment, null, resolvableType);
}
}

View File

@@ -92,12 +92,12 @@ public abstract class QueryByExampleDataFetcher<T> {
private final TypeInformation<T> domainType;
private final GraphQlArgumentBinder argumentInitializer;
private final GraphQlArgumentBinder argumentBinder;
QueryByExampleDataFetcher(TypeInformation<T> domainType) {
this.domainType = domainType;
this.argumentInitializer = new GraphQlArgumentBinder();
this.argumentBinder = new GraphQlArgumentBinder();
}
@@ -109,7 +109,7 @@ public abstract class QueryByExampleDataFetcher<T> {
@SuppressWarnings({"ConstantConditions", "unchecked"})
protected Example<T> buildExample(DataFetchingEnvironment env) throws BindException {
ResolvableType targetType = ResolvableType.forClass(this.domainType.getType());
return (Example<T>) Example.of(this.argumentInitializer.bind(env, null, targetType));
return (Example<T>) Example.of(this.argumentBinder.bind(env, null, targetType));
}
protected boolean requiresProjection(Class<?> resultType) {

View File

@@ -45,7 +45,8 @@ class GraphQlArgumentBinderTests {
private final ObjectMapper mapper = new ObjectMapper();
private final ThreadLocal<GraphQlArgumentBinder> initializer = ThreadLocal.withInitial(() -> new GraphQlArgumentBinder(null));
private final ThreadLocal<GraphQlArgumentBinder> initializer =
ThreadLocal.withInitial(() -> new GraphQlArgumentBinder(null));
@Test