public static Object parseArguments ( Method method , Object [ ] arguments ) { JsonRpcParamsPassMode paramsPassMode = JsonRpcParamsPassMode . AUTO ; JsonRpcMethod jsonRpcMethod = getAnnotation ( method , JsonRpcMethod . class ) ; if ( jsonRpcMethod != null ) paramsPassMode = jsonRpcMethod . paramsPassMode ( ) ; Map < String , Object > namedParams = getNamedParameters ( method , arguments ) ; switch ( paramsPassMode ) { case ARRAY : if ( namedParams . size ( ) > 0 ) { Object [ ] parsed = new Object [ namedParams . size ( ) ] ; int i = 0 ; for ( Object value : namedParams . values ( ) ) { parsed [ i ++ ] = value ; } return parsed ; } else { return arguments != null ? arguments : new Object [ ] { } ; } case OBJECT : if ( namedParams . size ( ) > 0 ) { return namedParams ; } else { if ( arguments == null ) { return new Object [ ] { } ; } throw new IllegalArgumentException ( "OBJECT parameters pass mode is impossible without declaring JsonRpcParam annotations for all parameters on method " + method . getName ( ) ) ; } case AUTO : default : if ( namedParams . size ( ) > 0 ) { return namedParams ; } else { return arguments != null ? arguments : new Object [ ] { } ; } } }
Parses the given arguments for the given method optionally turning them into named parameters .