|
Re: Multiple EType in EAttribute or EReference [message #689955 is a reply to message #689876] |
Tue, 28 June 2011 16:24 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Lancel,
Comments below.
On 28/06/2011 7:28 AM, lancel lau wrote:
> Hi,
>
> I am using EMF to define a model. When i define a EAttribute of a
> EClass, is it possible to set multiple choices to the EType of this
> EAttribute?
No. Like a Java field, you can only specify a single type.
> That means i can choose the EType of this EAttribute later during the
> instanciating of the model. Or is there any tricks to realize it?
You need to pick a type that's suitably general, e.g., EJavaObject for
attributes and EObject for references are the most general choice. Note
that that EJavaObject can only serialize things that implement
java.io.Serializeable and will produce a serialization that's not human
readable. So you might need to create your own EDataType that's able to
serialize and distinguish the serialization of some more restricted set
of types.
> Thanks
>
> regards
> lancel
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03131 seconds