|
Re: Extending external (non-ecore) class [message #426492 is a reply to message #426490] |
Thu, 08 January 2009 11:37 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
Alexander,
Comments below.
Alexander Dotor wrote:
> Hello,
>
> is it possible to extend a java class with an ecore class?
Yes and no...
>
> By entering an instance type name it is possible to implement/extend
> java interfaces, but for java classes the code generated from the
> genmodel is broken.
Yes, because EClasses generally mapped to interfaces and interfaces can
be multiply inherited. A class isn't an interface and you can't extend
more than one. Also, instances of EClasses are assumed to be EObjects
(as well as InternalEObjects) which is always achieved by subclasses
BasicEObjectImpl in some way. In theory one could mix in (duplicate)
the entire implementation hierarchy of BasicEObjectImpl, but that's a
lot of work and a lot of copying.
>
> A simple example would be java.util.ArrayList as base class that is
> extended by EcoreArrayList.
The two would even have conflicting rules for the implementation of
equality. It's better to look at composing such things than extending
them. Existing classes should generally be handled as EDataTypes...
>
> Cheers,
> Alexander
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02460 seconds