@Test public void testDeserialize() throws Exception { VocabWord word = new VocabWord(1, "word"); AbstractElementFactory<VocabWord> factory = new AbstractElementFactory<>(VocabWord.class); System.out.println("VocabWord JSON: " + word.toJSON()); VocabWord word2 = factory.deserialize(word.toJSON()); assertEquals(word, word2); }
@Override public VocabWord deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { VocabWord ret = mapper.readValue(json, VocabWord.class); return ret; } catch (IOException e) { throw new RuntimeException(e); } }
VocabWordFactory implements SequenceElementFactory<VocabWord> { @Override public VocabWord deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { VocabWord ret = mapper.readValue(json, VocabWord.class); return ret; } catch (IOException e) { throw new RuntimeException(e); } } }
VocabWordFactory implements SequenceElementFactory<VocabWord> { @Override public VocabWord deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { VocabWord ret = mapper.readValue(json, VocabWord.class); return ret; } catch (IOException e) { throw new RuntimeException(e); } }  }
VocabWordFactory implements SequenceElementFactory<VocabWord> { @Override public VocabWord deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { VocabWord ret = mapper.readValue(json, VocabWord.class); return ret; } catch (IOException e) { throw new RuntimeException(e); } }  @Override VocabWord deserialize(String json); @Override String serialize(VocabWord element); }
VocabWordFactory implements SequenceElementFactory<VocabWord> { @Override public VocabWord deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { VocabWord ret = mapper.readValue(json, VocabWord.class); return ret; } catch (IOException e) { throw new RuntimeException(e); } }  @Override VocabWord deserialize(String json); @Override String serialize(VocabWord element);  }