[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.emf] Re: Any documentation with delegating ELists

Randall,

Documentation?  Such a silly question... Just kidding.  ;-)

The basis for the delegating support is DelegatingEList.  It has many protected methods of the form delegateXyz for each Xyz that would be a regular List method, e.g., delegateSize().  All these methods have a default implementation that calls delegateList and redirects the call to it.  The delegateList method is the one abstract method that must be overridden; any of the other delegateXyz methods may also be overriden to compute a result more directly.

The class DelegatingEcoreEList.Dynamic is a useful endpoint to this scheme, by using it and overriding delegateList, you will have a list that produces the correct notification and handshaking behavior for the type of feature passed in the constructor.  This list can replace any of the existing specialized list implementations currently based on BasicEList/EcoreEList.
 

Randall Hauch wrote:

I'm intriqued by the following feature listed on the http://www.eclipse.org/emf/ page:
  • We have introduced org.eclipse.emf.common.util.DelegatingEList, org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl, and org.eclipse.emf.ecore.util.DelegatingEcoreEList to allow clients to wrap an existing list implementation that they may have as the "backing store" for a list that implements all the correct EMF behaviors.
I've searched the code and have found no use of these lists within the EMF or XSD plugins.  Is there any documentation for how these can be used?  If not, can you provide some direction?  I have a metamodel (i.e., genmodel/ecore model) and generated code, and my goal is to materialize (lazily) instances of these classes (i.e., a model) from some backing store.  Particularly:
  • Are there some logical places to "wrap" existing list implementations?  Modifying generated impls?  I can think of several possibilities, but perhaps there are one or even a few that are more logical than others.
  • What's the mechanism (particularly in DelegatingEcoreEList) for inserting the logic to populate the list from the backing store?  Are there methods in the DelegatingEcoreEList that should be overridden?  Or, is it more of a listener pattern?
Thanks in advance. Randall