As of Jackson 1.8, usage should be done using instance configured via {@link com.facebook.presto.hive.shaded.org.codehaus.jackson.map.ObjectMapper} (and exposed through{@link com.facebook.presto.hive.shaded.org.codehaus.jackson.map.DeserializationConfig} and{@link com.facebook.presto.hive.shaded.org.codehaus.jackson.map.SerializationConfig}). However, old static-singleton access methods are supported as well; however, using those may cause issues with extension modules that register "type enchancers".
Typical usage pattern before Jackson 1.8 was to statically import factory methods of this class, to allow convenient instantiation of structured types, especially {@link Collection} and {@link Map} typesto represent generic types. For example
mapType(String.class, Integer.class)to represent
Map<String,Integer>This is an alternative to using {@link TypeReference} that wouldbe something like
new TypeReference<Map<String,Integer>>() { }
Instances of this class are accessible using {@link com.facebook.presto.jdbc.internal.jackson.databind.ObjectMapper}as well as many objects it constructs (like {@link com.facebook.presto.jdbc.internal.jackson.databind.DeserializationConfig} and{@link com.facebook.presto.jdbc.internal.jackson.databind.SerializationConfig})), but usually those objects also expose convenience methods (constructType
). So, you can do for example:
JavaType stringType = mapper.constructType(String.class);However, more advanced methods are only exposed by factory so that you may need to use:
JavaType stringCollection = mapper.getTypeFactory().constructCollectionType(List.class, String.class);
Instances of this class are accessible using {@link com.fasterxml.jackson.databind.ObjectMapper}as well as many objects it constructs (like {@link com.fasterxml.jackson.databind.DeserializationConfig} and{@link com.fasterxml.jackson.databind.SerializationConfig})), but usually those objects also expose convenience methods (constructType
). So, you can do for example:
JavaType stringType = mapper.constructType(String.class);However, more advanced methods are only exposed by factory so that you may need to use:
JavaType stringCollection = mapper.getTypeFactory().constructCollectionType(List.class, String.class);
|
|
|
|
|
|