Skip to content

Commit a66b495

Browse files
committed
Polishing docs and removing unused code
1 parent 440b123 commit a66b495

File tree

12 files changed

+29
-126
lines changed

12 files changed

+29
-126
lines changed

spring-graphql-docs/src/docs/asciidoc/index.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,9 @@ You can explicitly specify the argument name, for example `@Argument("bookInput"
696696
it not specified, it defaults to the method parameter name, but this requires the
697697
`-parameters` compiler flag with Java 8+ or debugging information from the compiler.
698698

699-
The "required" character of an `@Argument` or its default value is controlled at the schema
700-
level.
699+
The `@Argument` annotation does not have a "required" flag, nor the option to specify a
700+
default value. Both of these can be specified at the GraphQL schema level and are enforced
701+
by the GraphQL Engine.
701702

702703
You can use `@Argument` on a `Map<String, Object>` argument, to obtain all argument
703704
values. The name attribute on `@Argument` must not be set.

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/Argument.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
* and a parameter name is not specified, then the map parameter is populated
3232
* via {@link graphql.schema.DataFetchingEnvironment#getArguments()}.
3333
*
34-
* <p>This annotation does not specify whether the input argument is required
35-
* and if it should use a default value: this should be done at the schema
36-
* in order to be enforced by the GraphQL engine itself.
34+
* <p>Note that this annotation has neither a "required" flag nor the option to
35+
* specify a default value, both of which can be specified at the GraphQL schema
36+
* level and are enforced by the GraphQL Java engine.
3737
*
3838
* @author Rossen Stoyanchev
3939
* @since 1.0.0

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/BatchMapping.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.core.annotation.AliasFor;
2525

2626
/**
27-
* Annotation for handler methods that batch load field values, given a list
27+
* Annotation for a handler method that batch loads field values, given a list
2828
* of source/parent values. For example:
2929
*
3030
* <pre class="code">
@@ -34,9 +34,10 @@
3434
* }
3535
* </pre>
3636
*
37-
* <p>The annotated method is registered as a batch loading function and along
37+
* <p>The annotated method is registered as a batch loading function via
38+
* {@link org.springframework.graphql.execution.BatchLoaderRegistry}, and along
3839
* with it, a {@link graphql.schema.DataFetcher} for the field is registered
39-
* transparently that looks up the field through the registered
40+
* transparently that looks up the field value through the registered
4041
* {@code DataLoader}.
4142
*
4243
* <p>Effectively, a shortcut for:
@@ -46,7 +47,7 @@
4647
* public class BookController {
4748
*
4849
* public BookController(BatchLoaderRegistry registry) {
49-
* registry.forTypePair(Long.class, Author.class).registerBatchLoader((ids, env) -> ...);
50+
* registry.forTypePair(Long.class, Author.class).registerBatchLoader((ids, environment) -> ...);
5051
* }
5152
*
5253
* &#064;SchemaMapping
@@ -60,7 +61,7 @@
6061
* @author Rossen Stoyanchev
6162
* @since 1.0.0
6263
*/
63-
@Target({ElementType.TYPE, ElementType.METHOD})
64+
@Target(ElementType.METHOD)
6465
@Retention(RetentionPolicy.RUNTIME)
6566
@Documented
6667
public @interface BatchMapping {
@@ -79,12 +80,12 @@
7980
String value() default "";
8081

8182
/**
82-
* Customizes the name of the parent/container type for the GraphQL field.
83-
* <p>By default, if not specified, it is derived from the class name of the
84-
* List of source/parent values injected into the handler method.
85-
* <p>This value for this attribute can be initialized from a class-level
83+
* Customizes the name of the source/parent type for the GraphQL field.
84+
* <p>By default, if not specified, it is based on the simple class name of
85+
* the List of source/parent values injected into the handler method.
86+
* <p>The value for this attribute can also be inherited from a class-level
8687
* {@link SchemaMapping @SchemaMapping}. When used on both levels, the one
87-
* on the method level overrides the one at the class level.
88+
* here overrides the one at the class level.
8889
*/
8990
String typeName() default "";
9091

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/QueryMapping.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @author Rossen Stoyanchev
3333
* @since 1.0.0
3434
*/
35-
@Target(value = {ElementType.TYPE, ElementType.METHOD})
35+
@Target(ElementType.METHOD)
3636
@Retention(RetentionPolicy.RUNTIME)
3737
@Documented
3838
@SchemaMapping(typeName = "Query")

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/SchemaMapping.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
String value() default "";
5353

5454
/**
55-
* Customizes the name of the parent/container type for the GraphQL field.
55+
* Customizes the name of the source/parent type for the GraphQL field.
5656
* <p>By default, if not specified, it is derived from the class name of a
5757
* {@link DataFetchingEnvironment#getSource() source} argument injected into
5858
* the handler method.

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/ValueConstants.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/ArgumentMethodArgumentResolver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import org.springframework.core.convert.TypeDescriptor;
2727
import org.springframework.graphql.data.method.HandlerMethodArgumentResolver;
2828
import org.springframework.graphql.data.method.annotation.Argument;
29-
import org.springframework.graphql.data.method.annotation.ValueConstants;
3029
import org.springframework.util.Assert;
3130
import org.springframework.util.StringUtils;
3231
import org.springframework.validation.DataBinder;

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/BatchLoaderHandlerMethod.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
import org.springframework.util.Assert;
3131

3232
/**
33-
* An extension of {@link HandlerMethod} for annotated handler methods adapted
34-
* to a batch loader function with a list of values and {@link BatchLoaderEnvironment}
35-
* as their input.
33+
* An extension of {@link HandlerMethod} for annotated handler methods adapted to
34+
* {@link org.dataloader.BatchLoaderWithContext} or
35+
* {@link org.dataloader.MappedBatchLoaderWithContext} with the list of keys and
36+
* {@link BatchLoaderEnvironment} as their input.
3637
*
3738
* @author Rossen Stoyanchev
3839
* @since 1.0.0
@@ -47,7 +48,7 @@ public BatchLoaderHandlerMethod(HandlerMethod handlerMethod) {
4748

4849
/**
4950
* Invoke the underlying batch loading method, resolving its arguments from
50-
* the given keys for batch loading and the {@link BatchLoaderEnvironment}.
51+
* the given keys and the {@link BatchLoaderEnvironment}.
5152
*
5253
* @param keys the batch loading keys
5354
* @param environment the environment available to batch loaders

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/ContinuationHandlerMethodArgumentResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public boolean supportsParameter(MethodParameter parameter) {
3333
}
3434

3535
@Override
36-
public Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment) throws Exception {
36+
public Object resolveArgument(MethodParameter parameter, DataFetchingEnvironment environment) {
3737
return null;
3838
}
3939

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/DataLoaderMethodArgumentResolver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import org.springframework.util.Assert;
2929

3030
/**
31-
* Resolver that retrieves arguments of type {@link DataLoader} from the
32-
* {@link DataFetchingEnvironment}.
31+
* Resolver for a {@link DataLoader} obtained via
32+
* {@link DataFetchingEnvironment#getDataLoader(String)}.
3333
*
34-
* <p>The {@code DataLoader} is looked up by deriving the key using one of the following:
34+
* <p>The {@code DataLoader} key is based on one of the following:
3535
* <ol>
3636
* <li>The full name of the value type from the DataLoader generic types.</li>
3737
* <li>The method parameter name.</li>

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/MissingArgumentException.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

spring-graphql/src/main/java/org/springframework/graphql/data/method/annotation/support/SourceMethodArgumentResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.springframework.util.Assert;
2626

2727
/**
28-
* Resolver for parent/container of a field, obtained via
28+
* Resolver for the source/parent of a field, obtained via
2929
* {@link DataFetchingEnvironment#getSource()}.
3030
*
3131
* <p>This resolver supports any non-simple value type, also excluding arrays

0 commit comments

Comments
 (0)