public Object [ ] buildParameters ( Object [ ] firstParameters , Method method , QueryAdapter queryAdapter , Class < ? extends Annotation > annotationType ) { int parametersLength = method . getParameterTypes ( ) . length ; if ( firstParameters . length > 0 && parametersLength < 1 ) { throw new RepositoryMethodException ( String . format ( "Method with %s annotation should have at least one parameter." , annotationType ) ) ; } int parametersToResolve = parametersLength - firstParameters . length ; Object [ ] additionalParameters = new Object [ parametersToResolve ] ; for ( int i = firstParameters . length ; i < parametersLength ; i ++ ) { Class < ? > parameterType = method . getParameterTypes ( ) [ i ] ; if ( isQueryType ( parameterType ) ) { additionalParameters [ i - firstParameters . length ] = toQueryObject ( queryAdapter , parameterType ) ; } else { additionalParameters [ i - firstParameters . length ] = parameterProvider . provide ( method , i ) ; } } return concatenate ( firstParameters , additionalParameters ) ; }
Build a list of parameters that can be provided to a method .