|
Re: Setting EEnum using reflective API [message #426750 is a reply to message #426709] |
Tue, 20 January 2009 04:16 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Morten,
Comments below.
Morten MacFly wrote:
> Dear all,
>
> I am trying (hard) to set an EAttribute to an EEnumLiteral I am
> obtaining from a string (user input in the end) using reflective API.
> However - I don't get it to work.
>
> Searching this NG revealed the following code (from 2003):
> ((EEnum) ea.getEType()).getEEnumLiteral(nodeValue).instance();
> which does not work for me as .instance() is not present (anymore?!).
>
A typo maybe? EEnumLiteral.getInstance() should work...
> I am doing the following:
> void setEEnum(EObject eo /* parent */, String valueAsString) {
> EAttribute ea = ecorePackage.Literals.PORT_ID;
> EEnum ee = ecorePackage.Literals.PORT_ID_ENUM;
> EEnumLiteral eel = ee.getEEnumLiteral(valueAsString);
> // ...
> // And now?
> }
>
> With best regards, Morten.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02545 seconds