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

2019-05-31 Thread David Bosschaert (JIRA)


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

David Bosschaert commented on FELIX-5678:
-

Hi [~dleangen] somehow I think that a merger is fundamentally different to a 
converter, albeit the case that it may be easy to implement a deep merger with 
the help of the converter. So to me it sounds like a separate component. 

I have to admit, I have not really had the need for a deep merger myself that 
often, but that doesn't mean others don't need it. 

I would suggest discussing it on one of the Felix mailing lists (for increased 
visibility) and maybe get an initial implementation started in Felix? Maybe we 
can take it from there?

Oh, and BTW it's certainly not too early for OSGi R8 proposals :)

> 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] [Assigned] (FELIX-6137) Converting an default-less annotation property throws instead of returning null

2019-05-31 Thread David Bosschaert (JIRA)


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

David Bosschaert reassigned FELIX-6137:
---

Assignee: David Bosschaert

> Converting an default-less annotation property throws instead of returning 
> null
> ---
>
> Key: FELIX-6137
> URL: https://issues.apache.org/jira/browse/FELIX-6137
> Project: Felix
>  Issue Type: Bug
>  Components: Converter
>Affects Versions: converter-1.0.8
>Reporter: Timothee Maret
>Assignee: David Bosschaert
>Priority: Major
>
> Converting a dictionary to an annotation that does not define a default value 
> property throws a {{org.osgi.util.converter.ConversionException}} like the 
> one below instead of returning {{null}}.
> {code}
> org.osgi.util.converter.ConversionException: No value for property: noDefault
>   at 
> org.osgi.util.converter.ConvertingImpl$4.invoke(ConvertingImpl.java:806)
>   at org.osgi.util.converter.$Proxy9.noDefault(Unknown Source)
>   at 
> org.osgi.util.converter.ConverterMapTest.testDictionaryToAnnotationWithoutDefault(ConverterMapTest.java:520)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>   at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>   at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>   at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>   at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>   at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>   at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>   at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> {code}



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


[jira] [Created] (FELIX-6139) Felix framework does not list it's full capabilties in it's manifest

2019-05-31 Thread JIRA
Raymond Augé created FELIX-6139:
---

 Summary: Felix framework does not list it's full capabilties in 
it's manifest
 Key: FELIX-6139
 URL: https://issues.apache.org/jira/browse/FELIX-6139
 Project: Felix
  Issue Type: Improvement
  Components: Framework
Reporter: Raymond Augé
 Fix For: framework-6.0.4


Because Felix framework does not list any capabilities _other than_ the 
packages it exports, it cannot be distinguished in a repository other than 
directly by it's bsn. This makes it impossible to select through capabilities 
that only a framework implementation could provide:

{code}
osgi.wiring.package;filter:='(osgi.wiring.package=org.osgi.framework.launch)',\
osgi.service;filter:='(objectClass=org.osgi.service.startlevel.StartLevel)'
{code}




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


[jira] [Commented] (FELIX-6137) Converting an default-less annotation property throws instead of returning null

2019-05-31 Thread David Bosschaert (JIRA)


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

David Bosschaert commented on FELIX-6137:
-

Hi [~marett], this is actually by design. You can convert a map to an interface 
or annotation without having to specify all the values available as methods in 
those. However, if you invoke a method on the interface or annotation for which 
no value is specified in the original map or a default is otherwise provided, 
the converter throws an exception. This behaviour is specified in the OSGi 
converter spec 
([https://osgi.org/specification/osgi.enterprise/7.0.0/util.converter.html#util.converter-maps)]
 section 707.4.4.4.5 Annotation states: "If no default is specified a 
ConversionException is thrown."

However, since returning {{null}} for undefined values is a pretty common 
scenario, you can quite easily achieve this by slightly customizing your 
converter using an Error Handler. This is described in section 707.7 
([https://osgi.org/specification/osgi.enterprise/7.0.0/util.converter.html#d0e107836)]
 of the converter spec.

So to apply this to your test case, instead of
{code:java}
@Test
public void testDictionaryToAnnotationWithoutDefault() {
  Dictionary dict = new TestDictionary<>();
  TestAnnotation ta = converter.convert(dict).to(TestAnnotation.class);
  assertEquals(null, ta.noDefault());
}
{code}
You can change it to:
{code:java}
@Test
public void testDictionaryToAnnotationWithoutDefault() {
  Converter nullDefaultConverter = converter.newConverterBuilder().
errorHandler((o,t) -> null).build();

  Dictionary dict = new TestDictionary<>();
  TestAnnotation ta = 
nullDefaultConverter.convert(dict).to(TestAnnotation.class);
  assertEquals(null, ta.noDefault());
}
{code}
Note the error handler lambda, which will return null instead of throwing a 
conversion exception. It will provide the behaviour you are looking for I think.
  

> Converting an default-less annotation property throws instead of returning 
> null
> ---
>
> Key: FELIX-6137
> URL: https://issues.apache.org/jira/browse/FELIX-6137
> Project: Felix
>  Issue Type: Bug
>  Components: Converter
>Affects Versions: converter-1.0.8
>Reporter: Timothee Maret
>Assignee: David Bosschaert
>Priority: Major
>
> Converting a dictionary to an annotation that does not define a default value 
> property throws a {{org.osgi.util.converter.ConversionException}} like the 
> one below instead of returning {{null}}.
> {code}
> org.osgi.util.converter.ConversionException: No value for property: noDefault
>   at 
> org.osgi.util.converter.ConvertingImpl$4.invoke(ConvertingImpl.java:806)
>   at org.osgi.util.converter.$Proxy9.noDefault(Unknown Source)
>   at 
> org.osgi.util.converter.ConverterMapTest.testDictionaryToAnnotationWithoutDefault(ConverterMapTest.java:520)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>   at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>   at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>   at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>   at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>   at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>   at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>   at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> {code}



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


[jira] [Comment Edited] (FELIX-6137) Converting an default-less annotation property throws instead of returning null

2019-05-31 Thread David Bosschaert (JIRA)


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

David Bosschaert edited comment on FELIX-6137 at 5/31/19 1:51 PM:
--

Hi [~marett], this is actually by design. You can convert a map to an interface 
or annotation without having to specify all the values available as methods in 
those. However, if you invoke a method on the interface or annotation for which 
no value is specified in the original map or a default is otherwise provided, 
the converter throws an exception. This behaviour is specified in the OSGi 
converter spec 
([https://osgi.org/specification/osgi.enterprise/7.0.0/util.converter.html#util.converter-maps)]
 section 707.4.4.4.5 Annotation states: "If no default is specified a 
ConversionException is thrown."

However, since returning {{null}} for undefined values is a pretty common 
scenario, you can quite easily achieve this by slightly customizing your 
converter using an Error Handler. This is described in section 707.7 
([https://osgi.org/specification/osgi.enterprise/7.0.0/util.converter.html#d0e107836)]
 of the converter spec.

So to apply this to your test case, instead of
{code:java}
@Test
public void testDictionaryToAnnotationWithoutDefault() {
  Dictionary dict = new TestDictionary<>();
  TestAnnotation ta = converter.convert(dict).to(TestAnnotation.class);
  assertEquals(null, ta.noDefault());
}
{code}
You can change it to:
{code:java}
@Test
public void testDictionaryToAnnotationWithoutDefault() {
  Converter nullDefaultConverter = converter.newConverterBuilder().
errorHandler((o,t) -> null).build();

  Dictionary dict = new TestDictionary<>();
  TestAnnotation ta = nullDefaultConverter.convert(dict).
to(TestAnnotation.class);
  assertEquals(null, ta.noDefault());
}
{code}
Note the error handler lambda, which will return null instead of throwing a 
conversion exception. It will provide the behaviour you are looking for I think.
  


was (Author: bosschaert):
Hi [~marett], this is actually by design. You can convert a map to an interface 
or annotation without having to specify all the values available as methods in 
those. However, if you invoke a method on the interface or annotation for which 
no value is specified in the original map or a default is otherwise provided, 
the converter throws an exception. This behaviour is specified in the OSGi 
converter spec 
([https://osgi.org/specification/osgi.enterprise/7.0.0/util.converter.html#util.converter-maps)]
 section 707.4.4.4.5 Annotation states: "If no default is specified a 
ConversionException is thrown."

However, since returning {{null}} for undefined values is a pretty common 
scenario, you can quite easily achieve this by slightly customizing your 
converter using an Error Handler. This is described in section 707.7 
([https://osgi.org/specification/osgi.enterprise/7.0.0/util.converter.html#d0e107836)]
 of the converter spec.

So to apply this to your test case, instead of
{code:java}
@Test
public void testDictionaryToAnnotationWithoutDefault() {
  Dictionary dict = new TestDictionary<>();
  TestAnnotation ta = converter.convert(dict).to(TestAnnotation.class);
  assertEquals(null, ta.noDefault());
}
{code}
You can change it to:
{code:java}
@Test
public void testDictionaryToAnnotationWithoutDefault() {
  Converter nullDefaultConverter = converter.newConverterBuilder().
errorHandler((o,t) -> null).build();

  Dictionary dict = new TestDictionary<>();
  TestAnnotation ta = 
nullDefaultConverter.convert(dict).to(TestAnnotation.class);
  assertEquals(null, ta.noDefault());
}
{code}
Note the error handler lambda, which will return null instead of throwing a 
conversion exception. It will provide the behaviour you are looking for I think.
  

> Converting an default-less annotation property throws instead of returning 
> null
> ---
>
> Key: FELIX-6137
> URL: https://issues.apache.org/jira/browse/FELIX-6137
> Project: Felix
>  Issue Type: Bug
>  Components: Converter
>Affects Versions: converter-1.0.8
>Reporter: Timothee Maret
>Assignee: David Bosschaert
>Priority: Major
>
> Converting a dictionary to an annotation that does not define a default value 
> property throws a {{org.osgi.util.converter.ConversionException}} like the 
> one below instead of returning {{null}}.
> {code}
> org.osgi.util.converter.ConversionException: No value for property: noDefault
>   at 
> org.osgi.util.converter.ConvertingImpl$4.invoke(ConvertingImpl.java:806)
>   at org.osgi.util.converter.$Proxy9.noDefault(Unknown Source)
>   at 
> org.osgi.util.converter.ConverterMapTest.testDictionaryToAnnotationWithoutDefault(ConverterMapTest.java:5

[jira] [Commented] (FELIX-6137) Converting an default-less annotation property throws instead of returning null

2019-05-31 Thread Timothee Maret (JIRA)


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

Timothee Maret commented on FELIX-6137:
---

Thanks [~bosschaert] for clarifying the behaviour and details to customise it! 
The custom converters works for me.

> Converting an default-less annotation property throws instead of returning 
> null
> ---
>
> Key: FELIX-6137
> URL: https://issues.apache.org/jira/browse/FELIX-6137
> Project: Felix
>  Issue Type: Bug
>  Components: Converter
>Affects Versions: converter-1.0.8
>Reporter: Timothee Maret
>Assignee: David Bosschaert
>Priority: Major
>
> Converting a dictionary to an annotation that does not define a default value 
> property throws a {{org.osgi.util.converter.ConversionException}} like the 
> one below instead of returning {{null}}.
> {code}
> org.osgi.util.converter.ConversionException: No value for property: noDefault
>   at 
> org.osgi.util.converter.ConvertingImpl$4.invoke(ConvertingImpl.java:806)
>   at org.osgi.util.converter.$Proxy9.noDefault(Unknown Source)
>   at 
> org.osgi.util.converter.ConverterMapTest.testDictionaryToAnnotationWithoutDefault(ConverterMapTest.java:520)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>   at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>   at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>   at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>   at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>   at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>   at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>   at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> {code}



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


[jira] [Resolved] (FELIX-6137) Converting an default-less annotation property throws instead of returning null

2019-05-31 Thread Timothee Maret (JIRA)


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

Timothee Maret resolved FELIX-6137.
---
   Resolution: Not A Bug
Fix Version/s: converter-1.0.10

Resolving as "Not A Bug". Thanks again [~bosschaert]!

> Converting an default-less annotation property throws instead of returning 
> null
> ---
>
> Key: FELIX-6137
> URL: https://issues.apache.org/jira/browse/FELIX-6137
> Project: Felix
>  Issue Type: Bug
>  Components: Converter
>Affects Versions: converter-1.0.8
>Reporter: Timothee Maret
>Assignee: David Bosschaert
>Priority: Major
> Fix For: converter-1.0.10
>
>
> Converting a dictionary to an annotation that does not define a default value 
> property throws a {{org.osgi.util.converter.ConversionException}} like the 
> one below instead of returning {{null}}.
> {code}
> org.osgi.util.converter.ConversionException: No value for property: noDefault
>   at 
> org.osgi.util.converter.ConvertingImpl$4.invoke(ConvertingImpl.java:806)
>   at org.osgi.util.converter.$Proxy9.noDefault(Unknown Source)
>   at 
> org.osgi.util.converter.ConverterMapTest.testDictionaryToAnnotationWithoutDefault(ConverterMapTest.java:520)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>   at java.lang.reflect.Method.invoke(Method.java:498)
>   at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>   at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>   at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>   at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>   at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>   at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>   at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>   at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>   at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>   at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>   at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>   at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>   at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>   at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>   at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> {code}



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


[jira] [Created] (FELIX-6140) possible deadlock in ResolverImpl.EnhancedExecutor.await()

2019-05-31 Thread Thomas Watson (JIRA)
Thomas Watson created FELIX-6140:


 Summary: possible deadlock in ResolverImpl.EnhancedExecutor.await()
 Key: FELIX-6140
 URL: https://issues.apache.org/jira/browse/FELIX-6140
 Project: Felix
  Issue Type: Bug
  Components: Resolver
Affects Versions: resolver-1.16.0, resolver-2.0.0
Reporter: Thomas Watson


The org.apache.felix.resolver.ResolverImpl.EnhancedExecutor class is used by 
the ResolverImpl in order to run tasks in parallel during a resolve process.  
When there is work that can happen in parallel the resolver will compute a 
number of tasks and dispatch each task to the executor and then await for all 
the tasks to complete.  To do this the current code uses an AtomicInteger to 
count up the number of tasks and then waits for each task to decrement the 
count back to zero.

The way the code builds up the tasks recursively leaves it open to incrementing 
the count and then getting some system failure. For example an 
OutOfMemoryException, or before OSGi R7 we used to have the executor throw a 
runtime exception on timeout.

This can make it such that the count will never reach zero and we end up 
hanging. 

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=547830 and possible fix that 
I plan to release soon at https://git.eclipse.org/r/#/c/143026/



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


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

2019-05-31 Thread David Leangen (JIRA)


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

David Leangen commented on FELIX-5678:
--

Hey [~bosschaert],

Hmmm, you may be right. It could be because I am using the Converter for 
something much greater than what it was intended to be.

It is, in my framework, a central integration tool, allowing the front-end to 
work seamlessly with the back end and data tiers, since all data is 
communicated via DTOs == JSON. It turns out that, thanks to the Converter, this 
kind of full-stack integration has a beautiful simplicity to it. No ORM etc. 
required, just the plain old Converter. I would have thought that everybody 
does this, which is why this functionality makes sense to me. If I am alone, 
then indeed it would likely be out-of-scope of the original intention.

I'll have to give this some thought and get back to you. Perhaps what I need is 
a higher level of abstraction based on the Converter. Then again, but for the 
patch operation, the abstraction would probably be identical!

I'll put this on hold again for now. I'll first build what I need outside of 
the Converter as you suggest, then decide whether or not it's worth trying to 
integrate with the Converter, and how. After prototyping, I'll consider making 
a proposal on the Felix list. Perhaps a paper to explain what I'm doing would 
be in order as well.

Thanks, as always, for your comments.

> 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] [Assigned] (FELIX-5678) Allow merging of objects

2019-05-31 Thread David Leangen (JIRA)


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

David Leangen reassigned FELIX-5678:


Assignee: David Leangen

> 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
>Assignee: 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] [Updated] (FELIX-5678) Allow merging of objects

2019-05-31 Thread David Leangen (JIRA)


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

David Leangen updated FELIX-5678:
-
Issue Type: New Feature  (was: Bug)

> Allow merging of objects
> 
>
> Key: FELIX-5678
> URL: https://issues.apache.org/jira/browse/FELIX-5678
> Project: Felix
>  Issue Type: New Feature
>  Components: Converter
>Reporter: David Leangen
>Assignee: 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)