Skip to content

Commit d924cdb

Browse files
committed
remove notes from graphQLAnnotationProcessor to other classes
1 parent bee616f commit d924cdb

File tree

9 files changed

+133
-169
lines changed

9 files changed

+133
-169
lines changed

src/main/java/graphql/annotations/GraphQLAnnotationsProcessor.java

Lines changed: 0 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -14,119 +14,7 @@
1414
*/
1515
package graphql.annotations;
1616

17-
import graphql.schema.*;
18-
import graphql.schema.GraphQLType;
19-
2017
public interface GraphQLAnnotationsProcessor {
21-
// /**
22-
// * @deprecated See {@link #getOutputType(Class)}
23-
// */
24-
// graphql.schema.GraphQLType getInterface(Class<?> iface) throws GraphQLAnnotationsException;
25-
//
26-
// /**
27-
// * This will examine the class and return a {@link GraphQLUnionType.Builder} ready for further definition
28-
// *
29-
// * @param iface interface to examine
30-
// *
31-
// * @return a {@link GraphQLUnionType.Builder}
32-
// *
33-
// * @throws GraphQLAnnotationsException if the class cannot be examined
34-
// * @throws IllegalArgumentException if <code>iface</code> is not an interface
35-
// */
36-
// GraphQLUnionType.Builder getUnionBuilder(Class<?> iface) throws GraphQLAnnotationsException, IllegalArgumentException;
37-
//
38-
// /**
39-
// * This will examine the class and return a {@link GraphQLInterfaceType.Builder} ready for further definition
40-
// *
41-
// * @param iface interface to examine
42-
// *
43-
// * @return a {@link GraphQLInterfaceType.Builder}
44-
// *
45-
// * @throws GraphQLAnnotationsException if the class cannot be examined
46-
// * @throws IllegalArgumentException if <code>iface</code> is not an interface
47-
// */
48-
// GraphQLInterfaceType.Builder getIfaceBuilder(Class<?> iface) throws GraphQLAnnotationsException, IllegalArgumentException;
49-
//
50-
// /**
51-
// * This will examine the object class and return a {@link GraphQLEnumType.Builder} ready for further definition
52-
// *
53-
// * @param object the object class to examine
54-
// *
55-
// * @return a {@link GraphQLEnumType.Builder} that represents that object class
56-
// *
57-
// * @throws GraphQLAnnotationsException if the object class cannot be examined
58-
// */
59-
// GraphQLEnumType.Builder getEnumBuilder(Class<?> object) throws GraphQLAnnotationsException;
60-
//
61-
// /**
62-
// * @deprecated See {@link #getOutputType(Class)}
63-
// */
64-
// GraphQLObjectType getObject(Class<?> object) throws GraphQLAnnotationsException;
65-
//
66-
// /**
67-
// * This will examine the object and will return a {@link GraphQLOutputType} based on the class type and annotations.
68-
// * - If its annotated with {@link GraphQLUnion} it will return a {@link GraphQLUnionType}
69-
// * - If its annotated with {@link GraphQLTypeResolver} it will return a {@link GraphQLInterfaceType}
70-
// * - It it's an Enum it will return a {@link GraphQLEnumType},
71-
// * otherwise it will return a {@link GraphQLObjectType}.
72-
// *
73-
// * @param object the object class to examine
74-
// *
75-
// * @return a {@link GraphQLOutputType} that represents that object class
76-
// *
77-
// * @throws GraphQLAnnotationsException if the object class cannot be examined
78-
// */
79-
// GraphQLOutputType getOutputType(Class<?> object) throws GraphQLAnnotationsException;
80-
//
81-
// /**
82-
// * @deprecated See {@link #getOutputTypeOrRef(Class)}
83-
// */
84-
// GraphQLOutputType getObjectOrRef(Class<?> object) throws GraphQLAnnotationsException;
85-
//
86-
// /**
87-
// * This will examine the object class and return a {@link GraphQLOutputType} representation
88-
// * which may be a {@link GraphQLOutputType} or a {@link graphql.schema.GraphQLTypeReference}
89-
// *
90-
// * @param object the object class to examine
91-
// *
92-
// * @return a {@link GraphQLOutputType} that represents that object class
93-
// *
94-
// * @throws GraphQLAnnotationsException if the object class cannot be examined
95-
// */
96-
// GraphQLOutputType getOutputTypeOrRef(Class<?> object) throws GraphQLAnnotationsException;
97-
//
98-
// /**
99-
// * This will examine the object class and return a {@link GraphQLObjectType.Builder} ready for further definition
100-
// *
101-
// * @param object the object class to examine
102-
// *
103-
// * @return a {@link GraphQLObjectType.Builder} that represents that object class
104-
// *
105-
// * @throws GraphQLAnnotationsException if the object class cannot be examined
106-
// */
107-
// GraphQLObjectType.Builder getObjectBuilder(Class<?> object) throws GraphQLAnnotationsException;
108-
//
109-
// /**
110-
// * This will examine the object class and return a {@link GraphQLInputType} representation
111-
// *
112-
// * @param object the object class to examine
113-
// *
114-
// * @return a {@link GraphQLInputType} that represents that object class
115-
// *
116-
// * @throws GraphQLAnnotationsException if the object class cannot be examined
117-
// */
118-
// GraphQLInputObjectType getInputObject(Class<?> object) throws GraphQLAnnotationsException;
119-
//
120-
// /**
121-
// * This will turn a {@link GraphQLObjectType} into a corresponding {@link GraphQLInputObjectType}
122-
// *
123-
// * @param graphQLType the graphql object type
124-
// * @param newNamePrefix since graphql types MUST be unique, this prefix will be applied to the new input types
125-
// *
126-
// * @return a {@link GraphQLInputObjectType}
127-
// */
128-
// GraphQLInputType getInputObject(GraphQLType graphQLType, String newNamePrefix);
129-
13018
/**
13119
* Register a new type extension class. This extension will be used when the extended object will be created.
13220
* The class must have a {@link GraphQLTypeExtension} annotation.

src/main/java/graphql/annotations/GraphQLInputObjectRetriever.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,33 +24,43 @@
2424

2525
public class GraphQLInputObjectRetriever {
2626

27+
28+
/**
29+
* This will turn a {@link GraphQLObjectType} into a corresponding {@link GraphQLInputObjectType}
30+
*
31+
* @param graphQLType the graphql object type
32+
* @param newNamePrefix since graphql types MUST be unique, this prefix will be applied to the new input types
33+
* @param typeRegistry object thata saves all the types
34+
* @return a {@link GraphQLInputObjectType}
35+
*/
36+
2737
public GraphQLInputType getInputObject(graphql.schema.GraphQLType graphQLType, String newNamePrefix, Map<String, graphql.schema.GraphQLType> typeRegistry) {
2838
if (graphQLType instanceof GraphQLObjectType) {
2939
return HandleGraphQLObjectType((GraphQLObjectType) graphQLType, newNamePrefix, typeRegistry);
3040
} else if (graphQLType instanceof GraphQLList) {
31-
return new GraphQLList(getInputObject(((GraphQLList)graphQLType).getWrappedType(), newNamePrefix,typeRegistry));
41+
return new GraphQLList(getInputObject(((GraphQLList) graphQLType).getWrappedType(), newNamePrefix, typeRegistry));
3242
} else if (graphQLType instanceof graphql.schema.GraphQLNonNull) {
33-
return new graphql.schema.GraphQLNonNull(getInputObject(((GraphQLNonNull)graphQLType).getWrappedType(), newNamePrefix,typeRegistry));
43+
return new graphql.schema.GraphQLNonNull(getInputObject(((GraphQLNonNull) graphQLType).getWrappedType(), newNamePrefix, typeRegistry));
3444
} else if (graphQLType instanceof GraphQLTypeReference) {
3545
return new GraphQLTypeReference(newNamePrefix + (graphQLType).getName());
36-
} else if (graphQLType instanceof GraphQLInputType){
46+
} else if (graphQLType instanceof GraphQLInputType) {
3747
return (GraphQLInputType) graphQLType;
3848
}
39-
throw new IllegalArgumentException("Cannot convert type to input : "+graphQLType);
49+
throw new IllegalArgumentException("Cannot convert type to input : " + graphQLType);
4050
}
4151

4252
private GraphQLInputType HandleGraphQLObjectType(GraphQLObjectType graphQLType, String newNamePrefix, Map<String, GraphQLType> typeRegistry) {
4353
GraphQLObjectType object = graphQLType;
44-
String newObjectName=newNamePrefix + object.getName();
45-
GraphQLType objectInTypeRegistry=typeRegistry.get(newObjectName);
46-
if (objectInTypeRegistry !=null && objectInTypeRegistry instanceof GraphQLInputType) {
54+
String newObjectName = newNamePrefix + object.getName();
55+
GraphQLType objectInTypeRegistry = typeRegistry.get(newObjectName);
56+
if (objectInTypeRegistry != null && objectInTypeRegistry instanceof GraphQLInputType) {
4757
return (GraphQLInputType) objectInTypeRegistry;
4858
}
4959
GraphQLInputObjectType inputObjectType = new GraphQLInputObjectType(newObjectName, object.getDescription(),
5060
object.getFieldDefinitions().stream().
5161
map(field -> {
5262
GraphQLOutputType type = field.getType();
53-
GraphQLInputType inputType = getInputObject(type, newNamePrefix,typeRegistry);
63+
GraphQLInputType inputType = getInputObject(type, newNamePrefix, typeRegistry);
5464
return new GraphQLInputObjectField(field.getName(), field.getDescription(), inputType, null);
5565
}).
5666
collect(Collectors.toList()));
Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,19 +15,29 @@
1515
package graphql.annotations;
1616

1717
import graphql.annotations.util.GraphQLOutputObjectRetriever;
18+
import graphql.schema.GraphQLUnionType;
1819

1920
public class GraphQLInterfaceRetriever {
2021

21-
private GraphQLOutputObjectRetriever graphQLOutputObjectRetriever;
22+
private GraphQLOutputObjectRetriever graphQLOutputObjectRetriever;
2223

23-
public GraphQLInterfaceRetriever(GraphQLOutputObjectRetriever graphQLOutputObjectRetriever){
24-
this.graphQLOutputObjectRetriever=graphQLOutputObjectRetriever;
24+
public GraphQLInterfaceRetriever(GraphQLOutputObjectRetriever graphQLOutputObjectRetriever) {
25+
this.graphQLOutputObjectRetriever = graphQLOutputObjectRetriever;
2526
}
2627

27-
public GraphQLInterfaceRetriever(){
28+
public GraphQLInterfaceRetriever() {
2829
this(new GraphQLOutputObjectRetriever());
2930
}
31+
32+
/**
33+
* This will examine the class and return a {@link graphql.schema.GraphQLOutputType} ready for further definition
34+
*
35+
* @param iface interface to examine
36+
* @param container a class that hold several members that are required in order to build schema
37+
* @return a {@link graphql.schema.GraphQLOutputType}
38+
* @throws GraphQLAnnotationsException if the class cannot be examined
39+
*/
3040
public graphql.schema.GraphQLOutputType getInterface(Class<?> iface, ProcessingElementsContainer container) throws GraphQLAnnotationsException {
31-
return graphQLOutputObjectRetriever.getOutputType(iface,container);
41+
return graphQLOutputObjectRetriever.getOutputType(iface, container);
3242
}
3343
}

src/main/java/graphql/annotations/builders/EnumBuilder.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,6 +33,13 @@ public EnumBuilder(GraphQLObjectInfoRetriever graphQLObjectInfoRetriever) {
3333
this.graphQLObjectInfoRetriever = graphQLObjectInfoRetriever;
3434
}
3535

36+
/**
37+
* This will examine the object class and return a {@link GraphQLEnumType.Builder} ready for further definition
38+
*
39+
* @param aClass the object class to examine
40+
* @return a {@link GraphQLEnumType.Builder} that represents that object class
41+
*/
42+
3643
public GraphQLEnumType.Builder getEnumBuilder(Class<?> aClass) {
3744
String typeName = graphQLObjectInfoRetriever.getTypeName(aClass);
3845
//noinspection unchecked

src/main/java/graphql/annotations/builders/ObjectBuilder.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,26 @@ public class ObjectBuilder {
3939
private BreadthFirstSearch breadthFirstSearch;
4040
private ParentalSearch parentalSearch;
4141
private GraphQLFieldRetriever graphQLFieldRetriever;
42-
private InterfaceBuilder interfaceBuilder;
4342
private GraphQLInterfaceRetriever graphQLInterfaceRetriever;
4443

45-
public ObjectBuilder(GraphQLObjectInfoRetriever graphQLObjectInfoRetriever, ParentalSearch parentalSearch, BreadthFirstSearch breadthFirstSearch,GraphQLFieldRetriever graphQLFieldRetriever,InterfaceBuilder interfaceBuilder,GraphQLInterfaceRetriever graphQLInterfaceRetriever) {
44+
public ObjectBuilder(GraphQLObjectInfoRetriever graphQLObjectInfoRetriever, ParentalSearch parentalSearch, BreadthFirstSearch breadthFirstSearch,GraphQLFieldRetriever graphQLFieldRetriever,GraphQLInterfaceRetriever graphQLInterfaceRetriever) {
4645
this.graphQLObjectInfoRetriever = graphQLObjectInfoRetriever;
4746
this.breadthFirstSearch=breadthFirstSearch;
4847
this.parentalSearch=parentalSearch;
4948
this.graphQLFieldRetriever=graphQLFieldRetriever;
50-
this.interfaceBuilder=interfaceBuilder;
5149
this.graphQLInterfaceRetriever=graphQLInterfaceRetriever;
5250
}
5351

54-
public GraphQLObjectType.Builder getObjectBuilder(Class<?> object, ProcessingElementsContainer container, GraphQLOutputObjectRetriever outputObjectRetriever) throws GraphQLAnnotationsException {
52+
/**
53+
* This will examine the object class and return a {@link GraphQLObjectType.Builder} ready for further definition
54+
*
55+
* @param object the object class to examine
56+
* @param container a class that hold several members that are required in order to build schema
57+
* @return a {@link GraphQLObjectType.Builder} that represents that object class
58+
* @throws GraphQLAnnotationsException if the object class cannot be examined
59+
*/
60+
61+
public GraphQLObjectType.Builder getObjectBuilder(Class<?> object, ProcessingElementsContainer container) throws GraphQLAnnotationsException {
5562
GraphQLObjectType.Builder builder = newObject();
5663
builder.name(graphQLObjectInfoRetriever.getTypeName(object));
5764
GraphQLDescription description = object.getAnnotation(GraphQLDescription.class);

src/main/java/graphql/annotations/builders/UnionBuilder.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Copyright 2016 Yurii Rashkovskii
3-
*
3+
* <p>
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
7+
* <p>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p>
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,6 +33,14 @@ public UnionBuilder(GraphQLObjectInfoRetriever graphQLObjectInfoRetriever) {
3333
this.graphQLObjectInfoRetriever = graphQLObjectInfoRetriever;
3434
}
3535

36+
/**
37+
* This will examine the class and return a {@link GraphQLUnionType.Builder} ready for further definition
38+
* @param container a class that hold several members that are required in order to build schema
39+
* @param iface interface to examine
40+
* @return a {@link GraphQLUnionType.Builder}
41+
* @throws GraphQLAnnotationsException if the class cannot be examined
42+
*/
43+
3644
public GraphQLUnionType.Builder getUnionBuilder(Class<?> iface, ProcessingElementsContainer container) throws GraphQLAnnotationsException, IllegalArgumentException {
3745
if (!iface.isInterface()) {
3846
throw new IllegalArgumentException(iface + " is not an interface");
@@ -58,7 +66,7 @@ public GraphQLUnionType.Builder getUnionBuilder(Class<?> iface, ProcessingElemen
5866
.map(new Function<Class<?>, graphql.schema.GraphQLType>() {
5967
@Override
6068
public graphql.schema.GraphQLType apply(Class<?> aClass) {
61-
return finalTypeFunction.buildType(aClass, null,container);
69+
return finalTypeFunction.buildType(aClass, null, container);
6270
}
6371
})
6472
.map(v -> (GraphQLObjectType) v)

0 commit comments

Comments
 (0)