@Override public DeserializerFactory withConfig(Config config) { // See super-class method for reasons for this check... if (getClass() != CustomDeserializerFactory.class) { throw new IllegalStateException("Subtype of CustomDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new CustomDeserializerFactory(config); }
public static ObjectMapper createCustomMapper() { ObjectMapper result = new ObjectMapper(); CustomDeserializerFactory deserializerFactory = new CustomDeserializerFactory(); deserializerFactory.addSpecificMapping(Configuration.class, new ConfigurationDeserializer()); deserializerFactory.addSpecificMapping(CounterMap.class, new CounterDeserializer()); result.setDeserializerProvider(new StdDeserializerProvider(deserializerFactory)); return result; }
@SuppressWarnings("unchecked") private <T> void typesafeAddMapping(Class<?> type, JsonDeserializer<T> deserializer, CustomDeserializerFactory factory) { factory.addSpecificMapping((Class<T>) type, deserializer); }
public static ObjectMapper createCustomMapper() { ObjectMapper result = new ObjectMapper(); CustomDeserializerFactory deserializerFactory = new CustomDeserializerFactory(); deserializerFactory.addSpecificMapping(Configuration.class, new ConfigurationDeserializer()); deserializerFactory.addSpecificMapping(CounterMap.class, new CounterDeserializer()); result.setDeserializerProvider(new StdDeserializerProvider(deserializerFactory)); return result; }
@Override public DeserializerFactory withConfig(Config config) { // See super-class method for reasons for this check... if (getClass() != CustomDeserializerFactory.class) { throw new IllegalStateException("Subtype of CustomDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new CustomDeserializerFactory(config); }
@Override public DeserializerFactory withConfig(Config config) { // See super-class method for reasons for this check... if (getClass() != CustomDeserializerFactory.class) { throw new IllegalStateException("Subtype of CustomDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new CustomDeserializerFactory(config); }
@Override public DeserializerFactory withConfig(Config config) { // See super-class method for reasons for this check... if (getClass() != CustomDeserializerFactory.class) { throw new IllegalStateException("Subtype of CustomDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new CustomDeserializerFactory(config); }
@Override public DeserializerFactory withConfig(Config config) { // See super-class method for reasons for this check... if (getClass() != CustomDeserializerFactory.class) { throw new IllegalStateException("Subtype of CustomDeserializerFactory ("+getClass().getName() +") has not properly overridden method 'withAdditionalDeserializers': can not instantiate subtype with " +"additional deserializer definitions"); } return new CustomDeserializerFactory(config); }
@Inject public JacksonJsonTransport(ConverterRegistry registry) { this.objectMapper = new ObjectMapper(); CustomDeserializerFactory deserializerFactory = new CustomDeserializerFactory(); // leave these for Jackson to handle exceptions.add(String.class); exceptions.add(Object.class); exceptions.addAll(Primitives.allWrapperTypes()); // Multimap<Type, ConverterDirection> typeToConverterDirection = ArrayListMultimap.create(); addConverterDirections(registry, true, typeToConverterDirection); addConverterDirections(registry, false, typeToConverterDirection); createJacksonDeserializers(deserializerFactory, typeToConverterDirection); objectMapper.setDeserializerProvider(new StdDeserializerProvider(deserializerFactory)); }