Skip to main content



      Home
Home » Modeling » EMF » Extending external (non-ecore) class
Extending external (non-ecore) class [message #426490] Thu, 08 January 2009 05:54 Go to next message
Eclipse UserFriend
Hello,

is it possible to extend a java class with an ecore class?

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.

A simple example would be java.util.ArrayList as base class that is
extended by EcoreArrayList.

Cheers,
Alexander
Re: Extending external (non-ecore) class [message #426492 is a reply to message #426490] Thu, 08 January 2009 06:37 Go to previous message
Eclipse UserFriend
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
Previous Topic:Resource loading
Next Topic:Literals missing from code generated by and ANT script
Goto Forum:
  


Current Time: Tue Jul 15 04:23:17 EDT 2025

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

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

Back to the top