private JSONArray buildArgsArray ( Object ... items ) throws Exception { JSONArray args = new JSONArray ( ) ; for ( int i = 0 ; i < items . length ; i ++ ) { if ( items [ i ] instanceof java . lang . String ) { args . put ( ( String ) items [ i ] ) ; } else if ( items [ i ] instanceof Number ) { args . put ( ( Number ) items [ i ] ) ; } else if ( items [ i ] instanceof java . lang . Boolean ) { args . put ( ( Boolean ) items [ i ] ) ; } else if ( items [ i ] == null ) { args . put ( ( Object ) null ) ; } else { throw new Exception ( "Invalid type" ) ; } } return args ; }
Internal function used to build a JSON Array of arguments from a list of items