|
|
Re: Trying to reference an interface from an EClass [message #425739 is a reply to message #425732] |
Fri, 05 December 2008 18:59 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Felix/Derek,
It's also possible to wrap an EClass around an existing interface (the
same as an EDataType does) and mark isInterface and isAbstract true.
This is typically most useful for use as an EClass.eSuperType. If used
as an EReference, EMF will assume that the actual instance value
implements EObject when it tried to serialize it, so that might be
bad. If you use an EDataType for an EAttribute, you generally will
need to write code in the generated XyzFactoryImpl to convert the
instance value to and from a string.
Felix Dorner wrote:
> Hey Derek,
>
>> I presume I cannot use interfaces as references the way I am
>> attempting. I would like to avoid generation of the factory method
>> and the Impl class or achieve some similar effect. What is the
>> correct approach for modeling a reference to an interface in an EClass?
>
> You can create an EDataType and set its class attribute to your
> interface type. Then in the referencing class use an EAttribute with
> that EDataType as its type.
>
> Felix
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03139 seconds