/** * Deserialize a {@link JSONArray} according to the rules of {@link #deserialize(JSONObject, Class)}. * * @param jsonArray the {@link JSONArray} * @param cls the {@link Class} of the elements in the {@code jsonArray} * @return the deserialization product */ @SuppressWarnings("unchecked") public static <T> List<T> deserializeAllAsList(JSONArray jsonArray, Class<T> cls) { return deserializeAllAsList(jsonArray, (JsonSerializer<T>) JsonSerializable.uncheckedSerializer(), cls); }
/** * Deserialize a {@link Class}-tagged {@link JSONObject} that should correspond to a {@link JsonSerializable}. * * @param jsonObject the {@link JSONObject} * @return the deserialization product */ @SuppressWarnings("unchecked") public static <T> T deserialize(JSONObject jsonObject) { if (isJsonNull(jsonObject)) return null; return deserialize(jsonObject, JsonSerializable.uncheckedSerializer()); }
/** * Deserialize a {@link JSONObject} that should correspond to a {@link JsonSerializable}. * * @param jsonObject the {@link JSONObject} * @param cls the {@link Class} of the deserialization product * @return the deserialization product */ @SuppressWarnings("unchecked") public static <T> T deserialize(JSONObject jsonObject, Class<? extends T> cls) { if (isJsonNull(jsonObject)) return null; return deserialize(jsonObject, (JsonSerializer<T>) JsonSerializable.uncheckedSerializer(), cls); }