|
|
|
|
|
Re: Storing a FeaturePath [message #1255176 is a reply to message #1252838] |
Mon, 24 February 2014 06:52 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
i'm writing way more to my config than only the featurepath. but no more details come from EMF. its just the path to access the attribute. (i do not need any properties of an EClass saved or similar (this will be used later on import/export, but at that time i will use Resource for sure) )
So, Ed, is it incorrect to do it the way i do it?
[Updated on: Mon, 24 February 2014 06:52] Report message to a moderator
|
|
|
Re: Storing a FeaturePath [message #1255177 is a reply to message #1252838] |
Mon, 24 February 2014 06:52 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
if i need to serialize feature paths I simply remember the Eclass the
path starts with and the feature names this is enough if you know the
EClass you start from.
Tom
On 21.02.14 17:55, Ed Merks wrote:
> Felix,
>
> Indeed, ideally the thing would serialize in the same resource, and yes,
> ideally you'd model it as a multi-valued reference to
> EStructuralFeatures. A derived transient volatile attribute could be
> used to provide a "convenience" get/setter than provided/accepted the
> FeatureMap data structure. Then all would serialize as normal...
>
>
> On 21/02/2014 2:31 PM, Felix Dorner wrote:
>> I think Ed meant to let EMF handle the details of serialization, for
>> example by using dynamic EMF. You just create an EPackage with a
>> single EClass that has a reference many of type EStructuralFeature. Then:
>>
>> EObject root = EcoreUtil.create(myFeaturePathClass);
>> root.eGet(path).addAll(allFeaturesInTheFeaturePath);
>>
>> Resource res = ResourceSetImpl().getResource("toto.featurePath", false);
>> res.getContents().add(root);
>> res.save(System.out, Collections.EMPTY_MAP);
>>
>> Maybe you want to register EcoreResourceFactory against the file
>> extension.
>>
>> Felix
>
|
|
|
Powered by
FUDForum. Page generated in 0.02578 seconds