question: private List < Group > parseGroups ( JSONArray groups , String groupType ) throws JSONException , AdeUsageException { if ( groups . length ( ) == 0 ) throw new AdeUsageException ( "No groups specified for group of type " + groupType ) ; List < Group > currentGroups = new ArrayList < Group > ( ) ; for ( int i = 0 ; i < groups . length ( ) ; i ++ ) { JSONObject group = groups . getJSONObject ( i ) ; String name = group . getString ( "name" ) ; String dataType = group . getString ( "dataType" ) ; short evalOrder = group . getShort ( "evaluationOrder" ) ; String ruleName = group . getString ( "ruleName" ) ; if ( ! verifyStringParam ( name , 200 , "[a-zA-Z0-9_ ]*" ) || name . equalsIgnoreCase ( "unassigned" ) || ! validateDataType ( dataType ) || evalOrder < 1 || ! verifyStringParam ( ruleName , 200 , "[a-zA-Z0-9_ ]*" ) ) { throw new AdeUsageException ( "Invalid parameters for a group of type " + groupType + " was specified" ) ; } currentGroups . add ( new Group ( name , GroupType . valueOf ( groupType ) , DataType . valueOf ( dataType . toUpperCase ( ) ) , evalOrder , ruleName ) ) ; } validateEvaluationOrderAndName ( currentGroups ) ; return currentGroups ; }
target:  Main logic for parsing the groups from the JSON file. Also does validation of the groups attributes.