@Test void readValue_test() { ConverterTestDto dto = jsonConverter.readValue("{\"value\":\"dummy\"}", ConverterTestDto.class); assertThat(dto.getValue()).isEqualTo("dummy"); }
public <T> T readValue(String src, Class<T> valueType) { try { return jsonMapper.readValue(src, valueType); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } }
JsonConverter implements Serializable { public <T> T readValue(String src, Class<T> valueType) { try { return jsonMapper.readValue(src, valueType); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } }
JsonConverter implements Serializable { public <T> T readValue(String src, Class<T> valueType) { try { return jsonMapper.readValue(src, valueType); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } JsonConverter(ObjectMapper jsonMapper); }
JsonConverter implements Serializable { public <T> T readValue(String src, Class<T> valueType) { try { return jsonMapper.readValue(src, valueType); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } JsonConverter(ObjectMapper jsonMapper); T readValue(String src, Class<T> valueType); T readValue(InputStream src, Class<T> valueType); T readValue(String src, TypeReference<T> valueTypeRef); T readValue(InputStream src, TypeReference<T> valueTypeRef); byte[] writeValueAsBytes(Object value); String writeValueAsString(Object value); }
JsonConverter implements Serializable { public <T> T readValue(String src, Class<T> valueType) { try { return jsonMapper.readValue(src, valueType); } catch (MismatchedInputException | JsonParseException e) { throw new DataConversionException(INPUT_MISMATCH_ERROR_MESSAGE, e); } catch (IOException e) { throw new UncheckedIOException(e); } } JsonConverter(ObjectMapper jsonMapper); T readValue(String src, Class<T> valueType); T readValue(InputStream src, Class<T> valueType); T readValue(String src, TypeReference<T> valueTypeRef); T readValue(InputStream src, TypeReference<T> valueTypeRef); byte[] writeValueAsBytes(Object value); String writeValueAsString(Object value);  }