Skip to content

Commit 5dfffe8

Browse files
committed
cleanup: reformat code and optimize imports
1 parent f56171f commit 5dfffe8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4344
-3533
lines changed

src/main/java/graphql/ExecutionResult.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33

44
import java.util.List;
5-
import java.util.Map;
65

76
public interface ExecutionResult {
87

src/main/java/graphql/ExecutionResultImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import java.util.ArrayList;
55
import java.util.List;
6-
import java.util.Map;
76

87
public class ExecutionResultImpl implements ExecutionResult {
98

src/main/java/graphql/GraphQLException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package graphql;
22

33

4-
public class GraphQLException extends RuntimeException{
4+
public class GraphQLException extends RuntimeException {
55

66
public GraphQLException() {
77
}

src/main/java/graphql/execution/ExecutionContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void addError(GraphQLError error) {
6969
this.errors.add(error);
7070
}
7171

72-
public List<GraphQLError> getErrors(){
72+
public List<GraphQLError> getErrors() {
7373
return errors;
7474
}
7575

src/main/java/graphql/execution/ExecutorServiceExecutionStrategy.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616

1717
/**
1818
* ExecutorServiceExecutionStrategy uses an {@link ExecutorService} to parallelize the resolve.
19-
* <p>
19+
* <p/>
2020
* Due to the nature of {@link #execute(ExecutionContext, GraphQLObjectType, Object, Map)} implementation, {@link ExecutorService}
2121
* MUST have the following 2 characteristics:
2222
* <ul>
23-
* <li>1. The underlying {@link java.util.concurrent.ThreadPoolExecutor} MUST have a reasonable {@code maximumPoolSize}
24-
* <li>2. The underlying {@link java.util.concurrent.ThreadPoolExecutor} SHALL NOT use its task queue.
23+
* <li>1. The underlying {@link java.util.concurrent.ThreadPoolExecutor} MUST have a reasonable {@code maximumPoolSize}
24+
* <li>2. The underlying {@link java.util.concurrent.ThreadPoolExecutor} SHALL NOT use its task queue.
2525
* </ul><p>
26-
*
26+
* <p/>
2727
* Failure to follow 1. and 2. can result in a very large number of threads created or hanging. (deadlock)
28-
* <p>
28+
* <p/>
2929
* See {@code graphql.execution.ExecutorServiceExecutionStrategyTest} for example usage.
3030
*/
3131
public class ExecutorServiceExecutionStrategy extends ExecutionStrategy {
@@ -38,7 +38,8 @@ public ExecutorServiceExecutionStrategy(ExecutorService executorService) {
3838

3939
@Override
4040
public ExecutionResult execute(final ExecutionContext executionContext, final GraphQLObjectType parentType, final Object source, final Map<String, List<Field>> fields) {
41-
if (executorService == null) return new SimpleExecutionStrategy().execute(executionContext, parentType, source, fields);
41+
if (executorService == null)
42+
return new SimpleExecutionStrategy().execute(executionContext, parentType, source, fields);
4243

4344
Map<String, Future<ExecutionResult>> futures = new LinkedHashMap<String, Future<ExecutionResult>>();
4445
for (String fieldName : fields.keySet()) {

src/main/java/graphql/execution/batched/Batched.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package graphql.execution.batched;
22

33
import graphql.schema.DataFetchingEnvironment;
4+
45
import java.lang.annotation.ElementType;
56
import java.lang.annotation.Retention;
67
import java.lang.annotation.RetentionPolicy;
@@ -13,48 +14,47 @@
1314
* This annotation must be used in conjunction with {@link BatchedExecutionStrategy}. Batching is valuable in many
1415
* situations, such as when a {@link graphql.schema.DataFetcher} must make a network or file system request.
1516
* </p>
16-
*
17+
* <p/>
1718
* <p>
1819
* When a {@link graphql.schema.DataFetcher} is batched, the {@link DataFetchingEnvironment#getSource()} method is
1920
* guaranteed to return a {@link java.util.List}. The {@link graphql.schema.DataFetcher#get(DataFetchingEnvironment)}
2021
* method MUST return a parallel {@link java.util.List} which is equivalent to running a {@link graphql.schema.DataFetcher}
2122
* over each input element individually.
2223
* </p>
23-
*
24+
* <p/>
2425
* <p>
25-
* Using the {@link Batched} annotation is equivalent to implementing {@link BatchedDataFetcher} instead of {@link graphql.schema.DataFetcher}.
26-
* It is preferred to use the {@link Batched} annotation.
26+
* Using the {@link Batched} annotation is equivalent to implementing {@link BatchedDataFetcher} instead of {@link graphql.schema.DataFetcher}.
27+
* It is preferred to use the {@link Batched} annotation.
2728
* </p>
28-
*
29+
* <p/>
2930
* For example, the following two {@link graphql.schema.DataFetcher} objects are interchangeable if used with a
3031
* {@link BatchedExecutionStrategy}.
31-
<pre>
32-
<code>
33-
new DataFetcher() {
34-
{@literal @}Override
35-
{@literal @}Batched
36-
public Object get(DataFetchingEnvironment environment) {
37-
{@code List<String> retVal = new ArrayList<>();}
38-
{@code for (String s: (List<String>) environment.getSource())} {
39-
retVal.add(s + environment.getArgument("text"));
40-
}
41-
return retVal;
42-
}
43-
}
44-
</code>
45-
</pre>
46-
*
4732
* <pre>
4833
* <code>
49-
new DataFetcher() {
50-
{@literal @}Override
51-
public Object get(DataFetchingEnvironment e) {
52-
return ((String)e.getSource()) + e.getArgument("text");
53-
}
54-
}
55-
</code>
34+
* new DataFetcher() {
35+
* {@literal @}Override
36+
* {@literal @}Batched
37+
* public Object get(DataFetchingEnvironment environment) {
38+
* {@code List<String> retVal = new ArrayList<>();}
39+
* {@code for (String s: (List<String>) environment.getSource())} {
40+
* retVal.add(s + environment.getArgument("text"));
41+
* }
42+
* return retVal;
43+
* }
44+
* }
45+
* </code>
46+
* </pre>
47+
* <p/>
48+
* <pre>
49+
* <code>
50+
* new DataFetcher() {
51+
* {@literal @}Override
52+
* public Object get(DataFetchingEnvironment e) {
53+
* return ((String)e.getSource()) + e.getArgument("text");
54+
* }
55+
* }
56+
* </code>
5657
* </pre>
57-
*
5858
*/
5959
@Target(ElementType.METHOD)
6060
@Retention(RetentionPolicy.RUNTIME)

src/main/java/graphql/execution/batched/BatchedDataFetcherFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.lang.reflect.Method;
77

88
/**
9-
*
109
* Produces a BatchedDataFetcher for a given DataFetcher.
1110
* If that fetcher is already a BatchedDataFetcher we return it.
1211
* If that fetcher's get method is annotated @Batched then we delegate to it directly.

src/main/java/graphql/execution/batched/ChildDataCollector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private <K, V> List<V> multimapGet(Map<K, List<V>> map, K key) {
3636

3737
public List<Entry> getEntries() {
3838
List<Entry> entries = new ArrayList<Entry>();
39-
for (String childTypename: childTypesByName.keySet()) {
39+
for (String childTypename : childTypesByName.keySet()) {
4040
GraphQLObjectType childType = childTypesByName.get(childTypename);
4141
List<GraphQLExecutionNodeDatum> childData = multimapGet(childDataByTypename, childTypename);
4242
entries.add(new Entry(childType, childData));
@@ -49,7 +49,7 @@ public static class Entry {
4949
private final List<GraphQLExecutionNodeDatum> data;
5050

5151
public Entry(GraphQLObjectType objectType,
52-
List<GraphQLExecutionNodeDatum> data) {
52+
List<GraphQLExecutionNodeDatum> data) {
5353
this.objectType = objectType;
5454
this.data = data;
5555
}

src/main/java/graphql/execution/batched/GraphQLExecutionNodeValue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public GraphQLExecutionResultContainer getResultContainer() {
1414
return resultContainer;
1515
}
1616

17-
/*Nullable*/ public Object getValue() {
17+
/*Nullable*/
18+
public Object getValue() {
1819
return value;
1920
}
2021
}

src/main/java/graphql/execution/batched/GraphQLExecutionResultContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public abstract class GraphQLExecutionResultContainer {
1111
* Creates a child datum which is linked through the results container to this parent.
1212
*/
1313
public GraphQLExecutionNodeDatum createAndPutChildDatum(String fieldName, Object value) {
14-
Map<String,Object> map = new HashMap<String, Object>();
14+
Map<String, Object> map = new HashMap<String, Object>();
1515
putResult(fieldName, map);
1616
return new GraphQLExecutionNodeDatum(map, value);
1717
}

0 commit comments

Comments
 (0)