|
Re: Serialization Option [message #689443 is a reply to message #689228] |
Mon, 27 June 2011 16:14 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Ben,
Comments below.
On 27/06/2011 12:51 AM, ben wrote:
> Hi,
>
> I'm looking for a options for serialize my EMF Model. My Model
> consisted of 1 EClass and 2 EAttributes.
>
> That follow part code shows how i create my dynamic EMF model. EClass
> purchaseOrderClass = ecoreFactory.createEClass();
> purchaseOrderClass.setName("PurchaseOrder");
> EAttribute shipTo = ecoreFactory.createEAttribute();
> shipTo.setName("shipTo");
> shipTo.setEType(EcorePackage.Literals.ESTRING);
> purchaseOrderClass.getEStructuralFeatures().add(shipTo);
> EAttribute billTo = ecoreFactory.createEAttribute();
> billTo.setName("billTo");
> billTo.setEType(EcorePackage.Literals.ESTRING);
> purchaseOrderClass.getEStructuralFeatures().add(billTo);
> This small part of code shows how create an instance of my dynamic
> EMF model. EFactory poFactory = poPackage.getEFactoryInstance();
>
> EObject purchaseOrder = poFactory.create(purchaseOrderClass);
>
> purchaseOrder.eSet(purchaseOrderClass.getEStructuralFeature("shipTo"),
> "123 Maple Street");
>
> purchaseOrder.eSet(purchaseOrderClass.getEStructuralFeature("billTo"),
> "200 Maple Street");
> And then, after serialization when i open the serialiezd model with
> "sample reflective ecore Model editor" ,i have this view.
> Purchase Order123 Maple Street
>
> Is there an option of serialization for choice the EAttributes for
> display like that: Purchase Order 200 Maple Street
No, the reflective editor has no idea which feature you'd prefer to use
as the label. It just picks one using a heuristic. If you make the
billTo address feature earlier in the list of the class' features, it
should pick that one instead.
>
> Any help will be appreciated.
>
> Ben
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03902 seconds