Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Multiple EType in EAttribute or EReference
icon5.gif  Multiple EType in EAttribute or EReference [message #689876] Tue, 28 June 2011 14:28 Go to next message
lancel lau is currently offline lancel lauFriend
Messages: 31
Registered: July 2009
Member
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? 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? Thanks

regards
lancel
Re: Multiple EType in EAttribute or EReference [message #689955 is a reply to message #689876] Tue, 28 June 2011 16:24 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:Serialization Option
Next Topic:EMF 3.0 / e4
Goto Forum:
  


Current Time: Tue Apr 23 17:34:02 GMT 2024

Powered by FUDForum. Page generated in 0.03131 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top