src/main/java/js/http/encoder/QueryParametersParser.java
public Object[] getArguments(Type[] formalParameters) {
		if (formalParameters.length == 0) {
			return new Object[0];
		}
		Object[] arguments = new Object[formalParameters.length];

		if (isObject(formalParameters)) {
			// if there is single formal parameter and it is not a value type create object instance and initialize fields from
			// request parameters; object class should have no arguments constructor
			Class<?> type = (Class<?>) formalParameters[0];
			Object object = Classes.newInstance(type);
			for (Parameter parameter : parameters) {
				Field field = Classes.getField(type, Strings.toMemberName(parameter.getName()));
				Classes.setFieldValue(object, field, asObject(parameter.getValue(), field.getType()));
			}
			return new Object[] { object };
		}

		int i = 0, argumentsCount = Math.min(formalParameters.length, parameters.size());
		for (i = 0; i < argumentsCount; ++i) {
			arguments[i] = asObject(parameters.get(i).getValue(), formalParameters[i]);
		}
		for (; i < formalParameters.length; ++i) {
			log.debug("Missing request parameter |%s|. Set it to null.", i, formalParameters[i]);
			arguments[i] = null;
		}
		for (; i < parameters.size(); ++i) {
			log.debug("Unused request parameter |%s|. Ignore it.", parameters.get(i));
		}
		return arguments;
	}
public Object[] getArguments(Type[] formalParameters) {
		if (formalParameters.length == 0) {
			return new Object[0];
		}
		Object[] arguments = new Object[formalParameters.length];

		if (isObject(formalParameters)) {
			// if there is single formal parameter and it is not a value type create object instance and initialize fields from
			// request parameters; object class should have no arguments constructor
			Class<?> type = (Class<?>) formalParameters[0];
			Object object = Classes.newInstance(type);
			for (Parameter parameter : parameters) {
				Field field = Classes.getField(type, Strings.toMemberName(parameter.getName()));
				Classes.setFieldValue(object, field, asObject(parameter.getValue(), field.getType()));
			}
			return new Object[] { object };
		}

		int i = 0, argumentsCount = Math.min(formalParameters.length, parameters.size());
		for (i = 0; i < argumentsCount; ++i) {
			arguments[i] = asObject(parameters.get(i).getValue(), formalParameters[i]);
		}
		for (; i < formalParameters.length; ++i) {
			log.debug("Missing request parameter |%s|. Set it to null.", i, formalParameters[i]);
			arguments[i] = null;
		}
		for (; i < parameters.size(); ++i) {
			log.debug("Unused request parameter |%s|. Ignore it.", parameters.get(i));
		}
		return arguments;
	}
public Object [ ] getArguments ( Type [ ] formalParameters ) { if ( formalParameters . length == 0 ) { return new Object [ 0 ] ; } Object [ ] arguments = new Object [ formalParameters . length ] ; if ( isObject ( formalParameters ) ) { // if there is single formal parameter and it is not a value type create object instance and initialize fields from
 // request parameters; object class should have no arguments constructor
 Class < ? > type = ( Class < ? > ) formalParameters [ 0 ] ; Object object = Classes . newInstance ( type ) ; for ( Parameter parameter : parameters ) { Field field = Classes . getField ( type , Strings . toMemberName ( parameter . getName ( ) ) ) ; Classes . setFieldValue ( object , field , asObject ( parameter . getValue ( ) , field . getType ( ) ) ) ; } return new Object [ ] { object } ; } int i = 0 , argumentsCount = Math . min ( formalParameters . length , parameters . size ( ) ) ; for ( i = 0 ; i < argumentsCount ; ++ i ) { arguments [ i ] = asObject ( parameters . get ( i ) . getValue ( ) , formalParameters [ i ] ) ; } for ( ; i < formalParameters . length ; ++ i ) { log . debug ( "Missing request parameter |%s|. Set it to null." , i , formalParameters [ i ] ) ; arguments [ i ] = null ; } for ( ; i < parameters . size ( ) ; ++ i ) { log . debug ( "Unused request parameter |%s|. Ignore it." , parameters . get ( i ) ) ; } return arguments ; }
Get an array of arguments suitable for a method invocation. This method did its best to fill the arguments array. The
logic is simple: ignore query extra parameters and set to null the missing ones. Both cases are recorded to debug log.
Returned arguments array has the same size as requested formal parameters array.
<p>
Parameter values from parsed {@link #parameters} are converted to requested type using {@link #asObject(String, Type)}
utility method. If formal parameters has a single type that has no converter uses reflection to map query parameters to
object field by name.
<p>
Note that because parameter names are not preserved on run-time, query parameters are mapped by position to invocation
arguments. This means is caller responsibility to match formal parameters order and type with actual query string
parameters.

@param formalParameters formal parameters list.
@return invocation arguments array.
@throws ConverterException if string value cannot be converted to requested type.
@throws BugError if type is generic and is not an array like.
Get an array of arguments suitable for a method invocation . This method did its best to fill the arguments array . The logic is simple : ignore query extra parameters and set to null the missing ones . Both cases are recorded to debug log . Returned arguments array has the same size as requested formal parameters array . <p > Parameter values from parsed { @link #parameters } are converted to requested type using { @link #asObject ( String Type ) } utility method . If formal parameters has a single type that has no converter uses reflection to map query parameters to object field by name . <p > Note that because parameter names are not preserved on run - time query parameters are mapped by position to invocation arguments . This means is caller responsibility to match formal parameters order and type with actual query string parameters .