@SuppressWarnings("unchecked") @Override public <T> T fromJSON(String json, Class<T> type) { if (json.contains(SerializationParts.ENCODED_TYPE)) { // This is Errai's native JSON format (we don't need to transform and don't need to rely on // the provided type since it's part of the payload) return (T) Marshalling.fromJSON(json); } return Marshalling.fromJSON(_fromJSON(json), type); }
@Override public Object fromJSON(String json) { return Marshalling.fromJSON(_fromJSON(json), Object.class); }
@Override public String toJSON(List<?> arr) { return _toJSON(Marshalling.toJSON(arr)); }
@Override public String toJSON(Object obj) { return _toJSON(Marshalling.toJSON(obj)); }
@SuppressWarnings("unchecked") @Override public <K, V> Map<K, V> fromJSON(String json, Class<?> type, Class<K> mapKeyType, Class<V> mapValueType) { return (Map<K, V>) Marshalling.fromJSON(_fromJSON(json), type, mapKeyType, mapValueType); }
@Override public String toJSON(Map<Object, Object> obj) { return _toJSON(Marshalling.toJSON(obj)); }