Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Derived Features and delete command
Derived Features and delete command [message #648271] Wed, 12 January 2011 08:42 Go to next message
Yves Bontemps is currently offline Yves BontempsFriend
Messages: 14
Registered: March 2010
Junior Member
Hi,

My model has a derived feature (say ClassA::allObjects) that must return the union of several many-valued EReferences.

I implemented this derived feature by providing code in ClassAImpl#getAllObjects() . The code simply builds a BasicEList with the union of the other references and returns that EList. According to EObject.eGet, that's what is expected.

However, when a DeleteCommand is run on an instance of ClassA, a cross-referencer finds all usages of ClassA and goes through BasicEObjectImpl.eSetting which does:


if (eFeature.isMany())
    {
      return (EStructuralFeature.Setting)eGet(eFeature, false);
    }


and triggers a ClassCastException (BasicEList is not an instance of EStructuralFeature.Setting.

How should I then implement my derived feature properly to avoid that error ?
Furthermore, if eGet is expected to return Settings instead of EList of the type of the feature, shouldn't that be properly specified on EObject ?

Thank you,
Yves.


Cheers,

Yves.
Re: Derived Features and delete command [message #648331 is a reply to message #648271] Wed, 12 January 2011 13:31 Go to previous message
Yves Bontemps is currently offline Yves BontempsFriend
Messages: 14
Registered: March 2010
Junior Member
Problem solved by looking at some generated code. The result of the derived method must be put in a subtype of EcoreEList to be both an EList and a Setting.

I chose EObjectResolvingEList.


Cheers,

Yves.
Previous Topic:[CDO] How to configure cdo-server.xml to use H2
Next Topic:[EMF Compare] Epatch and NullPointerException
Goto Forum:
  


Current Time: Wed Apr 24 19:23:30 GMT 2024

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

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

Back to the top