@Test public void testProvidenceModule() throws IOException { ObjectMapper mapper = new ObjectMapper(); ProvidenceModule.register(mapper); Request src = new Request(Binary.fromHexString("ABCDEF"), "ABCDEF", ImmutableList.of(Binary.fromBase64("2VjwBLYvTR6HkyjQY5rvZw")), ImmutableMap.of(Binary.fromBase64("5S+zeblRQF6kV5ScoTtSxA"), Binary.fromBase64("LlWY54WoTpOonW9sWnM7Kw"))); String tmp = mapper.writerFor(Request.class).writeValueAsString(src); assertThat(tmp, is( "{\"the_binary\":\"q83v\"," + "\"not_binary\":\"ABCDEF\"," + "\"list_of\":[\"2VjwBLYvTR6HkyjQY5rvZw\"]," + "\"map_of\":{\"5S+zeblRQF6kV5ScoTtSxA\":\"LlWY54WoTpOonW9sWnM7Kw\"}}")); Request req = mapper.readerFor(Request.class).readValue(tmp); assertThat(req, is(src)); }
public ProvidenceModule() { super("providence-core-jackson"); addSerializer(Binary.class, new BinarySerializer()); addDeserializer(Binary.class, new BinaryDeserializer()); addKeySerializer(Binary.class, new BinaryKeySerializer()); addKeyDeserializer(Binary.class, new BinaryKeyDeserializer()); }
ProvidenceModule extends SimpleModule { public ProvidenceModule() { super("providence-core-jackson"); addSerializer(Binary.class, new BinarySerializer()); addDeserializer(Binary.class, new BinaryDeserializer()); addKeySerializer(Binary.class, new BinaryKeySerializer()); addKeyDeserializer(Binary.class, new BinaryKeyDeserializer()); } }
ProvidenceModule extends SimpleModule { public ProvidenceModule() { super("providence-core-jackson"); addSerializer(Binary.class, new BinarySerializer()); addDeserializer(Binary.class, new BinaryDeserializer()); addKeySerializer(Binary.class, new BinaryKeySerializer()); addKeyDeserializer(Binary.class, new BinaryKeyDeserializer()); } ProvidenceModule(); }
ProvidenceModule extends SimpleModule { public ProvidenceModule() { super("providence-core-jackson"); addSerializer(Binary.class, new BinarySerializer()); addDeserializer(Binary.class, new BinaryDeserializer()); addKeySerializer(Binary.class, new BinaryKeySerializer()); addKeyDeserializer(Binary.class, new BinaryKeyDeserializer()); } ProvidenceModule(); static void register(ObjectMapper mapper); }
ProvidenceModule extends SimpleModule { public ProvidenceModule() { super("providence-core-jackson"); addSerializer(Binary.class, new BinarySerializer()); addDeserializer(Binary.class, new BinaryDeserializer()); addKeySerializer(Binary.class, new BinaryKeySerializer()); addKeyDeserializer(Binary.class, new BinaryKeyDeserializer()); } ProvidenceModule(); static void register(ObjectMapper mapper);  }