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

Randall,

You're right that the delegating lists aren't being used anywhere in EMF itself. They're used by clients that want to wrap their own storage implementation.

You use them in one of two ways ... both involve subclassing. The first approach is to override the delegateList() method to return an object implementing the java.util.List interface, to which the delegating list will delegate all the storage function. Alternatively, you can override delegateList() to return null, and then also override all the methods whose names start with "delegate" to use some other backing store.

The only currently available documentation on these classes is in our EMF book:  http://www.awprofessional.com/titles/0131425420. It doesn't cover them in great detail either - just an overview and API description.

Frank.
 

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