Commit e71a774c authored by liaozan's avatar liaozan 🏀

JacksonUtils#updateValue

parent 632d44e9
...@@ -219,6 +219,14 @@ public class JacksonUtils { ...@@ -219,6 +219,14 @@ public class JacksonUtils {
return getObjectMapper().getTypeFactory().constructType(TypeUtils.parameterize(genericsType, innerTypes)); return getObjectMapper().getTypeFactory().constructType(TypeUtils.parameterize(genericsType, innerTypes));
} }
public static <T> T updateValue(Object overrides, T valueToUpdate) {
try {
return getObjectMapper().updateValue(valueToUpdate, overrides);
} catch (Exception e) {
throw new JSONException("JSON 转换出错", e);
}
}
public static <T> T convertValue(Object fromValue, Class<T> toValueType) { public static <T> T convertValue(Object fromValue, Class<T> toValueType) {
return convertValue(fromValue, constructType(toValueType)); return convertValue(fromValue, constructType(toValueType));
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment