Code example for JsonParseException

0
public class AdapterUtil { 
    public static Class<?> classForName(String className) {
        try { 
            return Class.forName(className);
        } catch (ClassNotFoundException notused) {
            throw new JsonParseException(className);
        } 
    } 
    public static String getStringOrNull(JsonObject o, String property) {
        JsonElement el = o.get(property);
        if (el instanceof JsonNull)
            return null; 
        else if (el instanceof JsonPrimitive) {
            return ( (JsonPrimitive) el).getAsString();
        } else throw new RuntimeException(String.format("%s|%s", property, el.getClass().getName()));
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java