private static String validString ( Object data ) throws IOException { // Null is ok if ( data == null ) { return "" ; } if ( ! ( data instanceof String ) ) { throw new IOException ( "Invalid non-String value found!" ) ; } return ( String ) data ; }
Ensures one of the generic objects coming from the JSON library is in fact a String .