Describe the proposal
The following deserialize API asks for a Class<T>. It does not work with generic types.
<T> T deserialize(byte[] data, Class<T> clazz) throws IOException
Maybe add another method with the second param as java.lang.reflect.Type, which can accept both java.lang.Class and java.lang.reflect.ParameterizedType.
<T> T deserialize(byte[] data, java.lang.reflect.Type type) throws IOException
Jackson works with java.lang.reflect.Type as follows:
public <T> T deserialize(byte[] data, java.lang.reflect.Type type) throws IOException {
return objectMapper.readValue(data, objectMapper.constructType(type));
}
Describe the proposal
The following deserialize API asks for a
Class<T>. It does not work with generic types.Maybe add another method with the second param as
java.lang.reflect.Type, which can accept bothjava.lang.Classandjava.lang.reflect.ParameterizedType.Jackson works with
java.lang.reflect.Typeas follows: