EObject <-> Nested Property Map/Bean [message #425945] |
Fri, 12 December 2008 16:54  |
Eclipse User |
|
|
|
Originally posted by: mduduzi.keswa.isizwe.com
With all the tooling around EMF, I thought this capability is available
somehow. Let me explain:
1. I'm trying to send to clients Data Transfer Objects (DTOs) that have
been converted from instances of EObjects.
2. I imagine the conversion will be such that all nested attributes will
be converted to name-value pairs of the form
('attribname1.attribname2.attribname3','value') pair and references
will be converted to ('attribname1.attribname2.attribname3','RefID').
Is there a feature/tool/util that allows reflection (setting and
getting) using 'a.b.c.d' form of nested attributes within an EObject?
Thanks for your help.
-Mdu
|
|
|
|
|
Re: EObject <-> Nested Property Map/Bean [message #425950 is a reply to message #425949] |
Fri, 12 December 2008 17:44  |
Eclipse User |
|
|
|
Mdu,
Comments below.
Mdu wrote:
> Thanks Ed - see my comments below:
> Ed Merks wrote:
>> Mdu,
>>
>> Comments below.
>>
>> Mdu wrote:
>>> With all the tooling around EMF, I thought this capability is
>>> available somehow. Let me explain:
>>>
>>> 1. I'm trying to send to clients Data Transfer Objects (DTOs) that
>>> have been converted from instances of EObjects.
>>>
>>> 2. I imagine the conversion will be such that all nested attributes
>>> will be converted to name-value pairs of the form
>>> ('attribname1.attribname2.attribname3','value') pair and references
>>> will be converted to ('attribname1.attribname2.attribname3','RefID').
>> I don't really follow.
> I'm using databinding feature of a GUI library that generally works
> with beans. The GUI/form fields are bound using a.b.c.d conversion
> to refer to a nested bean property whose literal value is 3 levels
> deep - in this example. In java code I would normally call
> getA().getB().getC().
The data binding guys are doing some new work on properties-based data
binding that sounds related...
>
> Now I want to use reflective features of an EObject to do the same.
> From below it sounds like you're suggesting doing something like:
>
> EObject p = eObject.eGet(eObject.eClass().getEStructuralFeature("a"));
> p = p.eGet(eObject.eClass().getEStructuralFeature("b"));
You'd want to use p's eClass().
> p = p.eGet(eObject.eClass().getEStructuralFeature("c"));
>
> I could then take any EObject and convert to a java Map object of the
> form [('a.b.c','some literal value'), ...] and back to the original
> EOBject?
I guess so. I don't really understand that part... It does sound like
what you want is closely related to some new APIs the guys are working on.
>
> I'm oversimplifying my example for clarity.
>>>
>>>
>>> Is there a feature/tool/util that allows reflection (setting and
>>> getting) using 'a.b.c.d' form of nested attributes within an EObject?
>> You can use
>> eObject.eGet(eObject.eClass().getEStructuralFeature(<name>)) to look
>> up a named feature...
>>>
>>>
>>> Thanks for your help.
>>> -Mdu
|
|
|
Powered by
FUDForum. Page generated in 0.05184 seconds