/** * Deserialize a JSON string property into the specified Java type */ public static <T> T getValueFromJSON(AbstractModel model, JSONProperty<T> property, Type javaType) { String transitoryKey = transitoryKeyForProperty(property); checkCacheIntegrity(model, property, transitoryKey); if (!model.hasTransitory(transitoryKey)) { T data = null; String json = model.get(property); // Will throw if model doesn't have property if (json != null) { try { if (MAPPER == null) { throw new NullPointerException("JSONPropertySupport needs to be initialized with a " + "JSONMapper instance using setJSONMapper()"); } data = MAPPER.fromJSON(json, javaType); } catch (Exception e) { // TODO: Should this throw or at least not cache null? Logger.w(TAG, "Error deserializing JSON string: " + json, e); model.clearValue(property); } } putJSONTransitory(model, transitoryKey, data, json); return data; } JSONObjectHolder<T> holder = getJSONTransitory(model, transitoryKey); return holder.parsedObject; }