private boolean checkForFullTabularDataRepresentation ( JSONObject pValue , TabularType pType ) { if ( pValue . containsKey ( "indexNames" ) && pValue . containsKey ( "values" ) && pValue . size ( ) == 2 ) { Object jsonVal = pValue . get ( "indexNames" ) ; if ( ! ( jsonVal instanceof JSONArray ) ) { throw new IllegalArgumentException ( "Index names for tabular data must given as JSON array, not " + jsonVal . getClass ( ) ) ; } JSONArray indexNames = ( JSONArray ) jsonVal ; List < String > tabularIndexNames = pType . getIndexNames ( ) ; if ( indexNames . size ( ) != tabularIndexNames . size ( ) ) { throw new IllegalArgumentException ( "Given array with index names must have " + tabularIndexNames . size ( ) + " entries " + "(given: " + indexNames + ", required: " + tabularIndexNames + ")" ) ; } for ( Object index : indexNames ) { if ( ! tabularIndexNames . contains ( index . toString ( ) ) ) { throw new IllegalArgumentException ( "No index with name '" + index + "' known " + "(given: " + indexNames + ", required: " + tabularIndexNames + ")" ) ; } } return true ; } return false ; }
Check for a full table data representation and do some sanity checks