commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Takuya Murata <tak...@manjiro.net>
Subject [util] CollectionDelegate
Date Mon, 18 Aug 2003 23:31:19 GMT
Hello, everyone. I am new to here.

I have some Java classes I think it is nice that commons include. They 
are classes acting like AbstractCollection but actual implementation 
can be done in places other than its superclass.

Client code looks like:

public class Menu extends CollectionDelegate {
   private MenuImp imp;

   private Menu (MenuImp imp) {
     super (imp.collection ());
     this.imp = imp;
   }

   public Menu () {
     Menu (Util.getMenuImp ());
   }
}

As you see, collection is defined in somewhere and the implementation 
is acquired through imp.collection ().

The implementation of CollectionDelegate is simple and straightforward; 
as the name says, all methods defined in Collection interface is 
forwarded into

Likewise, ListCollection and similar delegate corresponding each 
collection interface should defined as well.

Hope this proposal sounds useful.

Takuya Murata
takusi@manjiro.net


Mime
View raw message