@Test public void testSimpleSerialization() throws Exception { final String outputString = "{\"timestamp\":\"2014-01-01T00:00:00.000Z\",\"at\":2}"; objectMapper.registerModule(new JodaModule()); final Serializer<MmxAuctionSummary> serializer = new JacksonSerializer<>(objectMapper); final byte[] eventBytes = serializer.serialize(sampleEventValid); final String eventString = objectMapper.writeValueAsString( objectMapper.readValue( eventBytes, MmxAuctionSummary.class ) ); Assert.assertEquals(eventString, outputString); }
@Override public byte[] serialize(T event) { try { return objectMapper.writeValueAsBytes(event); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } }
JacksonSerializer implements Serializer<T> { @Override public byte[] serialize(T event) { try { return objectMapper.writeValueAsBytes(event); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } } }
JacksonSerializer implements Serializer<T> { @Override public byte[] serialize(T event) { try { return objectMapper.writeValueAsBytes(event); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } } JacksonSerializer(ObjectMapper objectMapper); }
JacksonSerializer implements Serializer<T> { @Override public byte[] serialize(T event) { try { return objectMapper.writeValueAsBytes(event); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } } JacksonSerializer(ObjectMapper objectMapper); @Override byte[] serialize(T event); }
JacksonSerializer implements Serializer<T> { @Override public byte[] serialize(T event) { try { return objectMapper.writeValueAsBytes(event); } catch (JsonProcessingException e) { throw Throwables.propagate(e); } } JacksonSerializer(ObjectMapper objectMapper); @Override byte[] serialize(T event);  }