I'm trying to write a custom deserializer for Jackson and I want to make it generic (generic in the sense of working on any type, not as in "generics").
However I cannot seem to figure out how to get a handle to the type of the field being deserialized.
Eg, I'm looking to do something like the following:
@Override
public MyObject deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
Class c = <get type of current field>
// do something with that type
return new SubclassOfC(somedata based on c);
}
It's specifically the get type of current field part that I have struggled with.
Edit: It is the type of the java field I am interested in.