Brian Wellington wrote:
On Mon, 9 Oct 2006, Stefano Bagnara wrote:
Can I suggest to make some of the Cache private field/method protected or extract the Cache interface from the default implementation?

Are you suggesting simply making CacheMap public, and making the data field accessible? I don't think data should be public, but adding accessor methods would be ok.

I have not checked it yet but from a fast review making CacheMap public and data protected would anyway force as to use CacheMap extensions for the custom implementation.

Maybe the easier way would be:

- change data field type from CacheMap to Map
- change data field visibility from private to protected
- add casts to Cache.(set|get)MaxEntries()
-------
public int getMaxEntries() {
  return ((CacheMap) data).getMaxSize();
}

public void setMaxEntries(int entries) {
  ((CacheMap) data).setMaxSize(entries);
}
--------
This way it would be easier to provide a custom Map implementation by overriding the constructors (creating a different map instead of CacheMap) and overriding the get/set max entries to avoid the classcastexception.

What do you think?

Stefano


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to