private String parseParamsForStatistics(ParameterSet params, JSONObject obj) throws Exception
    {
        if ((params.toArray().length < 1) || (params.toArray().length > 2)) {
            return "Incorrect number of arguments to @Statistics (expects 2, received " +
                    params.toArray().length + ")";
        }
        Object first = params.toArray()[0];
        if (!(first instanceof String)) {
            return "First argument to @Statistics must be a valid STRING selector, instead was " +
                    first;
        }
        String subselector = (String)first;
        try {
            StatsSelector s = StatsSelector.valueOf(subselector.toUpperCase());
            subselector = s.name();
        }
        catch (Exception e) {
            return "First argument to @Statistics must be a valid STRING selector, instead was " +
                    first;
        }

        boolean interval = false;
        if (params.toArray().length == 2) {
            interval = ((Number)(params.toArray()[1])).longValue() == 1L;
        }
        obj.put("subselector", subselector);
        obj.put("interval", interval);

        return null;
    }
private String parseParamsForStatistics ( ParameterSet params , JSONObject obj ) throws Exception { if ( ( params . toArray ( ) . length < 1 ) || ( params . toArray ( ) . length > 2 ) ) { return "Incorrect number of arguments to @Statistics (expects 2, received " + params . toArray ( ) . length + ")" ; } Object first = params . toArray ( ) [ 0 ] ; if ( ! ( first instanceof String ) ) { return "First argument to @Statistics must be a valid STRING selector, instead was " + first ; } String subselector = ( String ) first ; try { StatsSelector s = StatsSelector . valueOf ( subselector . toUpperCase ( ) ) ; subselector = s . name ( ) ; } catch ( Exception e ) { return "First argument to @Statistics must be a valid STRING selector, instead was " + first ; } boolean interval = false ; if ( params . toArray ( ) . length == 2 ) { interval = ( ( Number ) ( params . toArray ( ) [ 1 ] ) ) . longValue ( ) == 1L ; } obj . put ( "subselector" , subselector ) ; obj . put ( "interval" , interval ) ; return null ; }
return null.  Yes, ugly.  Bang it out, then refactor later.