@Test public void update() { TestBean bean = new TestBean("A"); bean.setDefaultValue("lalala"); JsonMapper.INSTANCE.update("{\"name\":\"B\"}", bean); assertThat(bean.getName()).isEqualTo("B"); assertThat(bean.getDefaultValue()).isEqualTo("lalala"); }
public void update(String jsonString, Object object) { try { mapper.readerForUpdating(object).readValue(jsonString); } catch (JsonProcessingException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } catch (IOException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } }
JsonMapper { public void update(String jsonString, Object object) { try { mapper.readerForUpdating(object).readValue(jsonString); } catch (JsonProcessingException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } catch (IOException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } } }
JsonMapper { public void update(String jsonString, Object object) { try { mapper.readerForUpdating(object).readValue(jsonString); } catch (JsonProcessingException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } catch (IOException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } } JsonMapper();  JsonMapper(Include include); }
JsonMapper { public void update(String jsonString, Object object) { try { mapper.readerForUpdating(object).readValue(jsonString); } catch (JsonProcessingException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } catch (IOException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } } JsonMapper();  JsonMapper(Include include); static JsonMapper nonNullMapper(); static JsonMapper nonEmptyMapper(); static JsonMapper defaultMapper(); String toJson(Object object); T fromJson(@Nullable String jsonString, Class<T> clazz); T fromJson(@Nullable String jsonString, JavaType javaType); JavaType buildCollectionType(Class<? extends Collection> collectionClass, Class<?> elementClass); JavaType buildMapType(Class<? extends Map> mapClass, Class<?> keyClass, Class<?> valueClass); void update(String jsonString, Object object); String toJsonP(String functionName, Object object); void enableEnumUseToString(); ObjectMapper getMapper(); }
JsonMapper { public void update(String jsonString, Object object) { try { mapper.readerForUpdating(object).readValue(jsonString); } catch (JsonProcessingException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } catch (IOException e) { logger.warn("update json string:" + jsonString + " to object:" + object + " error.", e); } } JsonMapper();  JsonMapper(Include include); static JsonMapper nonNullMapper(); static JsonMapper nonEmptyMapper(); static JsonMapper defaultMapper(); String toJson(Object object); T fromJson(@Nullable String jsonString, Class<T> clazz); T fromJson(@Nullable String jsonString, JavaType javaType); JavaType buildCollectionType(Class<? extends Collection> collectionClass, Class<?> elementClass); JavaType buildMapType(Class<? extends Map> mapClass, Class<?> keyClass, Class<?> valueClass); void update(String jsonString, Object object); String toJsonP(String functionName, Object object); void enableEnumUseToString(); ObjectMapper getMapper(); static final JsonMapper INSTANCE; }