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- *
7+ * <p>
88 * http://www.apache.org/licenses/LICENSE-2.0
9- *
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.
@@ -36,10 +36,9 @@ public class MethodDataFetcher implements DataFetcher {
3636 private final TypeFunction typeFunction ;
3737
3838
39-
40- public MethodDataFetcher (Method method ,TypeFunction typeFunction , ProcessingElementsContainer container ) {
39+ public MethodDataFetcher (Method method , TypeFunction typeFunction , ProcessingElementsContainer container ) {
4140 this .method = method ;
42- this .typeFunction = typeFunction ;
41+ this .typeFunction = typeFunction ;
4342 this .container = container ;
4443 }
4544
@@ -60,15 +59,15 @@ public Object get(DataFetchingEnvironment environment) {
6059 return null ;
6160 }
6261 }
63- return method .invoke (obj , invocationArgs (environment ,container ));
62+ return method .invoke (obj , invocationArgs (environment , container ));
6463 } catch (IllegalAccessException | InvocationTargetException e ) {
6564 throw new RuntimeException (e );
6665 }
6766 }
6867
69- private Object [] invocationArgs (DataFetchingEnvironment environment ,ProcessingElementsContainer container ) {
68+ private Object [] invocationArgs (DataFetchingEnvironment environment , ProcessingElementsContainer container ) {
7069 List <Object > result = new ArrayList <>();
71- Map <String ,Object > envArgs = environment .getArguments ();
70+ Map <String , Object > envArgs = environment .getArguments ();
7271 for (Parameter p : method .getParameters ()) {
7372 String parameterName ;
7473 GraphQLName name = p .getAnnotation (GraphQLName .class );
@@ -84,7 +83,7 @@ private Object[] invocationArgs(DataFetchingEnvironment environment,ProcessingEl
8483 continue ;
8584 }
8685
87- graphql .schema .GraphQLType graphQLType = typeFunction .buildType (true , paramType , p .getAnnotatedType (),container );
86+ graphql .schema .GraphQLType graphQLType = typeFunction .buildType (true , paramType , p .getAnnotatedType (), container );
8887 if (envArgs .containsKey (parameterName )) {
8988 result .add (buildArg (p .getParameterizedType (), graphQLType , envArgs .get (parameterName )));
9089 } else {
@@ -112,15 +111,15 @@ private Object buildArg(Type p, GraphQLType graphQLType, Object arg) {
112111 Map map = (Map ) arg ;
113112 for (Parameter parameter : parameters ) {
114113 String name = toGraphqlName (parameter .getAnnotation (GraphQLName .class ) != null ? parameter .getAnnotation (GraphQLName .class ).value () : parameter .getName ());
115- objects .add (buildArg (parameter .getParameterizedType (), ((GraphQLInputObjectType )graphQLType ).getField (name ).getType (),map .get (name )));
114+ objects .add (buildArg (parameter .getParameterizedType (), ((GraphQLInputObjectType ) graphQLType ).getField (name ).getType (), map .get (name )));
116115 }
117116 return constructNewInstance (constructor , objects .toArray (new Object [objects .size ()]));
118117 }
119118 }
120119 return null ;
121120 } else if (p instanceof ParameterizedType && graphQLType instanceof GraphQLList ) {
122121 List <Object > list = new ArrayList <>();
123- Type subType = ((ParameterizedType )p ).getActualTypeArguments ()[0 ];
122+ Type subType = ((ParameterizedType ) p ).getActualTypeArguments ()[0 ];
124123 GraphQLType wrappedType = ((GraphQLList ) graphQLType ).getWrappedType ();
125124
126125 for (Object item : ((List ) arg )) {
0 commit comments