@@ -80,7 +80,7 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
80
80
}
81
81
82
82
@ Override
83
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
83
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
84
84
return Scalars .GraphQLString ;
85
85
}
86
86
}
@@ -98,7 +98,7 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
98
98
}
99
99
100
100
@ Override
101
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
101
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
102
102
return Scalars .GraphQLBoolean ;
103
103
}
104
104
}
@@ -116,7 +116,7 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
116
116
}
117
117
118
118
@ Override
119
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
119
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
120
120
return Scalars .GraphQLFloat ;
121
121
}
122
122
}
@@ -134,7 +134,7 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
134
134
}
135
135
136
136
@ Override
137
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
137
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
138
138
return Scalars .GraphQLInt ;
139
139
}
140
140
}
@@ -152,7 +152,7 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
152
152
}
153
153
154
154
@ Override
155
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
155
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
156
156
return Scalars .GraphQLLong ;
157
157
}
158
158
}
@@ -168,7 +168,7 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
168
168
}
169
169
170
170
@ Override
171
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
171
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
172
172
if (!(annotatedType instanceof AnnotatedParameterizedType )) {
173
173
throw new IllegalArgumentException ("List type parameter should be specified" );
174
174
}
@@ -180,7 +180,7 @@ public GraphQLType buildType(String typeName, Class<?> aClass, AnnotatedType ann
180
180
} else {
181
181
klass = (Class <?>) arg .getType ();
182
182
}
183
- return new GraphQLList (DefaultTypeFunction .this .buildType (klass , arg ));
183
+ return new GraphQLList (DefaultTypeFunction .this .buildType (inputType , klass , arg ));
184
184
}
185
185
}
186
186
@@ -192,7 +192,7 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
192
192
}
193
193
194
194
@ Override
195
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
195
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
196
196
if (!(annotatedType instanceof AnnotatedParameterizedType )) {
197
197
throw new IllegalArgumentException ("Stream type parameter should be specified" );
198
198
}
@@ -204,7 +204,7 @@ public GraphQLType buildType(String typeName, Class<?> aClass, AnnotatedType ann
204
204
} else {
205
205
klass = (Class <?>) arg .getType ();
206
206
}
207
- return new GraphQLList (DefaultTypeFunction .this .buildType (klass , arg ));
207
+ return new GraphQLList (DefaultTypeFunction .this .buildType (inputType , klass , arg ));
208
208
}
209
209
}
210
210
@@ -222,9 +222,9 @@ public String getTypeName(Class<?> aClass, AnnotatedType annotatedType) {
222
222
}
223
223
224
224
@ Override
225
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
225
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
226
226
AnnotatedType arg = getAnnotatedType (annotatedType );
227
- return DefaultTypeFunction .this .buildType (typeName , getClass (annotatedType ), arg );
227
+ return DefaultTypeFunction .this .buildType (inputType , getClass (annotatedType ), arg );
228
228
}
229
229
230
230
private AnnotatedType getAnnotatedType (AnnotatedType annotatedType ) {
@@ -259,12 +259,11 @@ public boolean canBuildType(Class<?> aClass, AnnotatedType annotatedType) {
259
259
}
260
260
261
261
@ Override
262
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
263
- try {
264
- return annotationsProcessor .getOutputTypeOrRef (aClass );
265
- } catch (ClassCastException e ) {
266
- // Also try to resolve to input object
262
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
263
+ if (inputType ) {
267
264
return annotationsProcessor .getInputObject (aClass );
265
+ } else {
266
+ return annotationsProcessor .getOutputTypeOrRef (aClass );
268
267
}
269
268
}
270
269
}
@@ -322,13 +321,13 @@ public String getTypeName(Class<?> aClass, AnnotatedType annotatedType) {
322
321
}
323
322
324
323
@ Override
325
- public GraphQLType buildType (String typeName , Class <?> aClass , AnnotatedType annotatedType ) {
324
+ public GraphQLType buildType (boolean inputType , Class <?> aClass , AnnotatedType annotatedType ) {
326
325
TypeFunction typeFunction = getTypeFunction (aClass , annotatedType );
327
326
if (typeFunction == null ) {
328
327
throw new IllegalArgumentException ("unsupported type" );
329
328
}
330
329
331
- GraphQLType result = typeFunction .buildType (typeName , aClass , annotatedType );
330
+ GraphQLType result = typeFunction .buildType (inputType , aClass , annotatedType );
332
331
if (aClass .getAnnotation (GraphQLNonNull .class ) != null ||
333
332
(annotatedType != null && annotatedType .getAnnotation (GraphQLNonNull .class ) != null )) {
334
333
result = new graphql .schema .GraphQLNonNull (result );
0 commit comments