@Test public void testUnmarshal() { UserPreferences res = marshaller.unmarshal(UserPreferences.class, "{\"e_hi\":\"0\",\"e_he\":\"1\"}"); UserPreferences up = new UserPreferences(); up.setShowCqlCompletionHint(false); assertEquals(up, res); }
public @NotNull <T> T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input) { T unmarshalObj; try { unmarshalObj = objectMapper.get().readValue(input, clazz); } catch (IOException e) { throw new ServiceException("Got IOException during json unmarshalling: " + e.getMessage() + " - input:'" + input + "'", e); } LOG.trace("Unmarshaled JSON from {} to {}", input, unmarshalObj); return unmarshalObj; }
JsonMarshaller { public @NotNull <T> T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input) { T unmarshalObj; try { unmarshalObj = objectMapper.get().readValue(input, clazz); } catch (IOException e) { throw new ServiceException("Got IOException during json unmarshalling: " + e.getMessage() + " - input:'" + input + "'", e); } LOG.trace("Unmarshaled JSON from {} to {}", input, unmarshalObj); return unmarshalObj; } }
JsonMarshaller { public @NotNull <T> T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input) { T unmarshalObj; try { unmarshalObj = objectMapper.get().readValue(input, clazz); } catch (IOException e) { throw new ServiceException("Got IOException during json unmarshalling: " + e.getMessage() + " - input:'" + input + "'", e); } LOG.trace("Unmarshaled JSON from {} to {}", input, unmarshalObj); return unmarshalObj; } JsonMarshaller(); }
JsonMarshaller { public @NotNull <T> T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input) { T unmarshalObj; try { unmarshalObj = objectMapper.get().readValue(input, clazz); } catch (IOException e) { throw new ServiceException("Got IOException during json unmarshalling: " + e.getMessage() + " - input:'" + input + "'", e); } LOG.trace("Unmarshaled JSON from {} to {}", input, unmarshalObj); return unmarshalObj; } JsonMarshaller(); @NotNull T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input); @NotNull String marshal(@NotNull Object obj); }
JsonMarshaller { public @NotNull <T> T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input) { T unmarshalObj; try { unmarshalObj = objectMapper.get().readValue(input, clazz); } catch (IOException e) { throw new ServiceException("Got IOException during json unmarshalling: " + e.getMessage() + " - input:'" + input + "'", e); } LOG.trace("Unmarshaled JSON from {} to {}", input, unmarshalObj); return unmarshalObj; } JsonMarshaller(); @NotNull T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input); @NotNull String marshal(@NotNull Object obj);  }