@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 T deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { T ret = (T) mapper.readValue(json, targetClass); return ret; } catch (IOException e) { throw new RuntimeException(e); } }
AbstractElementFactory implements SequenceElementFactory<T> { @Override public T deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { T ret = (T) mapper.readValue(json, targetClass); return ret; } catch (IOException e) { throw new RuntimeException(e); } } }
AbstractElementFactory implements SequenceElementFactory<T> { @Override public T deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { T ret = (T) mapper.readValue(json, targetClass); return ret; } catch (IOException e) { throw new RuntimeException(e); } } AbstractElementFactory(@NonNull Class<? extends SequenceElement> cls); }
AbstractElementFactory implements SequenceElementFactory<T> { @Override public T deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { T ret = (T) mapper.readValue(json, targetClass); return ret; } catch (IOException e) { throw new RuntimeException(e); } } AbstractElementFactory(@NonNull Class<? extends SequenceElement> cls); @Override T deserialize(String json); @Override String serialize(T element); }
AbstractElementFactory implements SequenceElementFactory<T> { @Override public T deserialize(String json) { ObjectMapper mapper = SequenceElement.mapper(); try { T ret = (T) mapper.readValue(json, targetClass); return ret; } catch (IOException e) { throw new RuntimeException(e); } } AbstractElementFactory(@NonNull Class<? extends SequenceElement> cls); @Override T deserialize(String json); @Override String serialize(T element);  }