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.
@@ -32,10 +32,9 @@ class MethodDataFetcher implements DataFetcher {
3232 private final TypeFunction typeFunction ;
3333
3434
35-
36- public MethodDataFetcher (Method method ,TypeFunction typeFunction , ProcessingElementsContainer container ) {
35+ public MethodDataFetcher (Method method , TypeFunction typeFunction , ProcessingElementsContainer container ) {
3736 this .method = method ;
38- this .typeFunction = typeFunction ;
37+ this .typeFunction = typeFunction ;
3938 this .container = container ;
4039 }
4140
@@ -56,15 +55,15 @@ public Object get(DataFetchingEnvironment environment) {
5655 return null ;
5756 }
5857 }
59- return method .invoke (obj , invocationArgs (environment ,container ));
58+ return method .invoke (obj , invocationArgs (environment , container ));
6059 } catch (IllegalAccessException | InvocationTargetException e ) {
6160 throw new RuntimeException (e );
6261 }
6362 }
6463
65- private Object [] invocationArgs (DataFetchingEnvironment environment ,ProcessingElementsContainer container ) {
64+ private Object [] invocationArgs (DataFetchingEnvironment environment , ProcessingElementsContainer container ) {
6665 List <Object > result = new ArrayList <>();
67- Map <String ,Object > envArgs = environment .getArguments ();
66+ Map <String , Object > envArgs = environment .getArguments ();
6867 for (Parameter p : method .getParameters ()) {
6968 String parameterName ;
7069 GraphQLName name = p .getAnnotation (GraphQLName .class );
@@ -80,7 +79,7 @@ private Object[] invocationArgs(DataFetchingEnvironment environment,ProcessingEl
8079 continue ;
8180 }
8281
83- graphql .schema .GraphQLType graphQLType = typeFunction .buildType (true , paramType , p .getAnnotatedType (),container );
82+ graphql .schema .GraphQLType graphQLType = typeFunction .buildType (true , paramType , p .getAnnotatedType (), container );
8483 if (envArgs .containsKey (parameterName )) {
8584 result .add (buildArg (p .getParameterizedType (), graphQLType , envArgs .get (parameterName )));
8685 } else {
@@ -108,15 +107,15 @@ private Object buildArg(Type p, GraphQLType graphQLType, Object arg) {
108107 Map map = (Map ) arg ;
109108 for (Parameter parameter : parameters ) {
110109 String name = toGraphqlName (parameter .getAnnotation (GraphQLName .class ) != null ? parameter .getAnnotation (GraphQLName .class ).value () : parameter .getName ());
111- objects .add (buildArg (parameter .getParameterizedType (), ((GraphQLInputObjectType )graphQLType ).getField (name ).getType (),map .get (name )));
110+ objects .add (buildArg (parameter .getParameterizedType (), ((GraphQLInputObjectType ) graphQLType ).getField (name ).getType (), map .get (name )));
112111 }
113112 return constructNewInstance (constructor , objects .toArray (new Object [objects .size ()]));
114113 }
115114 }
116115 return null ;
117116 } else if (p instanceof ParameterizedType && graphQLType instanceof GraphQLList ) {
118117 List <Object > list = new ArrayList <>();
119- Type subType = ((ParameterizedType )p ).getActualTypeArguments ()[0 ];
118+ Type subType = ((ParameterizedType ) p ).getActualTypeArguments ()[0 ];
120119 GraphQLType wrappedType = ((GraphQLList ) graphQLType ).getWrappedType ();
121120
122121 for (Object item : ((List ) arg )) {
0 commit comments