-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
3.0Issue planned for initial 3.0 releaseIssue planned for initial 3.0 release
Description
cc: @cowtowncoder
I saw people using Jackson to do it, but in a not-so-efficient way:
MyPojo myPojo = new MyPojo();
ObjectMapper mapper = new ObjectMapper();
MyPojo newPojo = mapper.readValue(mapper.writeValueAsString(myPojo), MyPojo.class);
I know about ObjetMapper.convertValue
method, but the problem is that it returns the original value is of the given type:
...
Class<?> targetType = toValueType.getRawClass();
if (targetType != Object.class
&& !toValueType.hasGenericTypes()
&& targetType.isAssignableFrom(fromValue.getClass())) {
return fromValue;
}
...
And also the note is the documentation which reads:
Note that it is possible that in some cases behavior does differ from full serialize-then-deserialize cycle
So can we have (an overloaded version of) convertValue
(or a new method) to behave totally as deep copy?
aaylward, AlexTrotsenko and jimages
Metadata
Metadata
Assignees
Labels
3.0Issue planned for initial 3.0 releaseIssue planned for initial 3.0 release