[jira] [Commented] (FELIX-5678) Allow merging of objects

2019-05-30 Thread David Leangen (JIRA)


[ 
https://issues.apache.org/jira/browse/FELIX-5678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16852604#comment-16852604
 ] 

David Leangen commented on FELIX-5678:
--

Just to update the information here with two discoveries as I continue to 
investigate...

Although perhaps frequently required, the number of "places" in the code where 
the patch operation is required is probably limited, mostly to the lower-level 
data layer. This would be an argument against having a patch operation in the 
Converter.

An argument for, though, is that a patch may be "deep". This turns out to be 
non-trivial (i.e. more complex than just putAll as you suggest), as there is a 
need to iterate deep into the object. This traversal is already being done 
internally by the Converter, so it may provide a great opportunity to perform 
this operation from inside the Converter.

> 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 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)


[jira] [Commented] (FELIX-5678) Allow merging of objects

2019-05-30 Thread David Leangen (JIRA)


[ 
https://issues.apache.org/jira/browse/FELIX-5678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 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)


[jira] [Resolved] (FELIX-6138) Missing support for temporal types

2019-05-30 Thread Timothy Ward (JIRA)


 [ 
https://issues.apache.org/jira/browse/FELIX-6138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Timothy Ward resolved FELIX-6138.
-
Resolution: Fixed

Fixed in SVN revision r1860413

> Missing support for temporal types
> --
>
> Key: FELIX-6138
> URL: https://issues.apache.org/jira/browse/FELIX-6138
> Project: Felix
>  Issue Type: Bug
>  Components: Converter
>Affects Versions: converter-1.0.8
>Reporter: Timothy Ward
>Assignee: Timothy Ward
>Priority: Major
> Fix For: converter-1.0.10
>
>
> Table *707.2* of the compendium specification (in section 707.4.2.3) contains 
> mappings for a number of types from java.time. Several of these types are not 
> supported by the converter.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (FELIX-6138) Missing support for temporal types

2019-05-30 Thread Timothy Ward (JIRA)
Timothy Ward created FELIX-6138:
---

 Summary: Missing support for temporal types
 Key: FELIX-6138
 URL: https://issues.apache.org/jira/browse/FELIX-6138
 Project: Felix
  Issue Type: Bug
  Components: Converter
Affects Versions: converter-1.0.8
Reporter: Timothy Ward
Assignee: Timothy Ward
 Fix For: converter-1.0.10


Table *707.2* of the compendium specification (in section 707.4.2.3) contains 
mappings for a number of types from java.time. Several of these types are not 
supported by the converter.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FELIX-5678) Allow merging of objects

2019-05-30 Thread David Bosschaert (JIRA)


[ 
https://issues.apache.org/jira/browse/FELIX-5678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16851706#comment-16851706
 ] 

David Bosschaert commented on FELIX-5678:
-

Hi [~dleangen],

I think the simplest solution would be to take your 2 objects and convert them 
both to simple Maps using the converter. Then you can merge the 2 maps by 
calling {{map1.putAll(map2)}}
 Finally you can convert your resulting map back to the target object you need 
using the converter.

Alternatively you should be able to use a custom converter rule like described 
in the first comment, and in more detail here: 
[https://osgi.org/specification/osgi.enterprise/7.0.0/util.converter.html#util.converter-customizing.converters]

Let me know if this helps...

Cheers,

David

> 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 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)