List of usage examples for com.fasterxml.jackson.databind.module SimpleModule SimpleModule
public SimpleModule()
From source file:com.google.gplus.processor.GooglePlusActivitySerDeIT.java
/** * setup./*from www . ja v a 2 s .c o m*/ */ @BeforeClass public void setup() { objectMapper = StreamsJacksonMapper.getInstance(); SimpleModule simpleModule = new SimpleModule(); simpleModule.addDeserializer(com.google.api.services.plus.model.Activity.class, new GPlusActivityDeserializer()); objectMapper.registerModule(simpleModule); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); }
From source file:org.n52.tamis.core.test.serialize.ExecuteInputSerializer_Test.java
@Before public void setupMapper() { input_WpsProxySerializer = new ExecuteInputSerializer(); mapper = new ObjectMapper(); SimpleModule module = new SimpleModule(); module.addSerializer(ExecuteInput.class, input_WpsProxySerializer); mapper.registerModule(module);/*from w w w . ja v a 2 s.c o m*/ }
From source file:org.apache.streams.gplus.GooglePlusPersonSerDeIT.java
/** * setup./*from w ww. j av a2 s . c o m*/ */ @BeforeClass public void setup() { objectMapper = StreamsJacksonMapper.getInstance(); SimpleModule simpleModule = new SimpleModule(); simpleModule.addDeserializer(Person.class, new GPlusPersonDeserializer()); objectMapper.registerModule(simpleModule); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); }
From source file:de.escalon.hypermedia.hydra.serialize.JacksonHydraSerializerTest.java
@Before public void setUp() { mapper = new ObjectMapper(); // see https://github.com/json-ld/json-ld.org/issues/76 mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.registerModule(new SimpleModule() { public void setupModule(SetupContext context) { super.setupModule(context); context.addBeanSerializerModifier(new BeanSerializerModifier() { public JsonSerializer<?> modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) { if (serializer instanceof BeanSerializerBase) { return new JacksonHydraSerializer((BeanSerializerBase) serializer); } else { return serializer; }//from w w w .jav a 2 s . co m } }); } }); }
From source file:com.google.gplus.GooglePlusCommentSerDeIT.java
/** * setup.//www . j a v a2 s . co m */ @BeforeClass public void setupTestCommentObjects() { objectMapper = StreamsJacksonMapper.getInstance(); SimpleModule simpleModule = new SimpleModule(); simpleModule.addDeserializer(Comment.class, new GPlusCommentDeserializer()); objectMapper.registerModule(simpleModule); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); googlePlusActivityUtil = new GooglePlusActivityUtil(); }
From source file:com.google.gplus.GooglePlusPersonSerDeIT.java
/** * setup./*from w ww. j ava 2 s . c om*/ */ @BeforeClass public void setup() { objectMapper = StreamsJacksonMapper.getInstance(); SimpleModule simpleModule = new SimpleModule(); simpleModule.addDeserializer(Person.class, new GPlusPersonDeserializer()); objectMapper.registerModule(simpleModule); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); googlePlusActivityUtil = new GooglePlusActivityUtil(); }
From source file:org.apache.streams.datasift.util.StreamsDatasiftMapper.java
public StreamsDatasiftMapper() { super();//from w w w .ja v a2 s . c om registerModule(new SimpleModule() { { addDeserializer(DateTime.class, new StdDeserializer<DateTime>(DateTime.class) { @Override public DateTime deserialize(JsonParser jpar, DeserializationContext context) throws IOException, JsonProcessingException { DateTime result = null; try { result = DATASIFT_FORMATTER.parseDateTime(jpar.getValueAsString()); } catch (Exception e) { } if (result == null) { try { result = RFC3339Utils.getInstance().parseToUTC(jpar.getValueAsString()); } catch (Exception e) { } } return result; } }); } }); }
From source file:org.jmingo.mapping.marshall.jackson.MongoMapper.java
public MongoMapper() { addMixInAnnotations();/*from w w w. j a va 2 s .com*/ setVisibilityChecker(getSerializationConfig().getDefaultVisibilityChecker() .withFieldVisibility(JsonAutoDetect.Visibility.ANY) .withGetterVisibility(JsonAutoDetect.Visibility.NONE) .withSetterVisibility(JsonAutoDetect.Visibility.NONE) .withCreatorVisibility(JsonAutoDetect.Visibility.NONE)); configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); SimpleModule mongoModule = new SimpleModule(); mongoModule.addDeserializer(ObjectId.class, new ObjectIdDeserializer()); mongoModule.addSerializer(ObjectId.class, new ObjectIdSerializer()); mongoModule.addDeserializer(Date.class, new MongoDateDeserializer()); mongoModule.addSerializer(Date.class, new BsonDateSerializer()); registerModule(mongoModule); }
From source file:org.zalando.problem.ProblemModule.java
@Override public void setupModule(final SetupContext context) { final SimpleModule module = new SimpleModule(); module.setMixInAnnotation(Exceptional.class, stacktraces ? ExceptionalWithStacktraceMixin.class : ExceptionalMixin.class); module.setMixInAnnotation(DefaultProblem.class, DefaultProblemMixIn.class); module.setMixInAnnotation(Problem.class, ProblemMixIn.class); module.addSerializer(StatusType.class, new StatusTypeSerializer()); module.addDeserializer(StatusType.class, new StatusTypeDeserializer(statuses)); module.setupModule(context);//from ww w. j ava2 s .c om }
From source file:org.apache.streams.twitter.converter.StreamsTwitterMapper.java
public StreamsTwitterMapper() { super();/*from w w w .j a va 2 s . c om*/ registerModule(new SimpleModule() { { addDeserializer(DateTime.class, new StdDeserializer<DateTime>(DateTime.class) { @Override public DateTime deserialize(JsonParser jpar, DeserializationContext context) throws IOException, JsonProcessingException { DateTime result = null; try { result = TWITTER_FORMATTER.parseDateTime(jpar.getValueAsString()); } catch (Exception e) { } try { result = RFC3339Utils.getInstance().parseToUTC(jpar.getValueAsString()); } catch (Exception e) { } return result; } }); } }); }