-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Since ObjectMappers are mutable, I am exposing ObjectReader and ObjectWriter through a factory.
Whereas ObjectMapper.readValue(String content, Class valueType) is of known Type =valueType, the equivalent methods on ObjectReader are declared as returning T but do not take a Class valueType parameter.
Even ObjectReader.forType(Class<?> valueType) does not return a parameterized instance of ObjectReader.
The impact is that, whereas with ObjectMapper.readValue(String,Class) I do not have to typecast the returned value, when I start using ObjectReader.readValue(String) or ObjectReader.forType(Class).readValue(String) I must explicitly typecast the result.
Surely either ObjectReader.readValue should be overloaded with Class valueType (presumably this is trivially easy), or ObjectReader.forType(Class valueType) should return a fully parameterized ObjectReader (more complicated as ObjectReader is not a parameterized class)?