Search in sources :

Example 1 with Argument

use of org.springframework.graphql.data.method.annotation.Argument in project spring-graphql by spring-projects.

the class ArgumentMethodArgumentResolver method getArgumentName.

static String getArgumentName(MethodParameter parameter) {
    Argument annotation = parameter.getParameterAnnotation(Argument.class);
    Assert.state(annotation != null, "Expected @Argument annotation");
    if (StringUtils.hasText(annotation.name())) {
        return annotation.name();
    }
    String parameterName = parameter.getParameterName();
    if (parameterName != null) {
        return parameterName;
    }
    throw new IllegalArgumentException("Name for argument of type [" + parameter.getNestedParameterType().getName() + "] not specified, and parameter name information not found in class file either.");
}
Also used : Argument(org.springframework.graphql.data.method.annotation.Argument)

Aggregations

Argument (org.springframework.graphql.data.method.annotation.Argument)1