[
https://issues.apache.org/jira/browse/FELIX-5678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16852320#comment-16852320
]
David Leangen commented on FELIX-5678:
--------------------------------------
Thanks, [~bosschaert].
I get that. I have no problem technically making a customisation for my own
code, but this is an operation that is wide ranging and fundamental, IMO. It
would be nice to have a way to do this on the platform level. Is there any
possibility of proposing this for R8? In the meantime, is there any way of
extending or branding the current release?
This type of operation could be thought of as being analogous to http patch.
(Maybe it should even be called "patch" instead of "merge".) For people like me
who use DTOs extensively as a fundamental building block, it is a
frequently-used operation. Also it would be much more efficient to do it as a
"native" operation of the converter rather than having to do multiple
conversions.
Any thoughts? Or is it too early to be discussing R8 and extensions?
> Allow merging of objects
> ------------------------
>
> Key: FELIX-5678
> URL: https://issues.apache.org/jira/browse/FELIX-5678
> Project: Felix
> Issue Type: Bug
> Components: Converter
> Reporter: David Leangen
> Priority: Major
>
> Given a typed object O1 and a "partial" representation of an object O2 (for
> instance in the form of a Map), allow O2 to be merged into O1.
> Example:
> {code}
> public class Foo {
> public String a;
> public String b;
> public String c;
> }
> Foo f = new Foo();
> a = "Eh!";
> b = "Be cool.";
> c = "See you later?";
> Map<String, String> m = new Map<>();
> m.put("b", "Be there or be square");
> Foo f2 = Converter.convert(f).merge(m);
> {code}
> I am sure there are many ways to skin this cat.
> If the Converter API cannot be changed, what would be the best way to tackle
> this problem?
> (In the meantime, while awaiting comments form [~bosschaert], I'll try to run
> a few experiments to see if I can come up with something reasonable.)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)