Why not convert all methods that can take Options to varargs?
Example:
cache.get(Fqn f, Object key, Option... o);
You can then call it with or without option, i.e.:
cache.get("a/b/c", "k");
And also like this:
Option myOption = ...
| cache.get("a/b/c", "k", myOption);
Even better now, you can define individual Option as subsclasses/implementations of Option
allowing each to carry extra parameters if needed.
For example: Let's imagine that for
https://jira.jboss.org/jira/browse/JBCACHE-1470 we
would like to add the cache listener class to the supress event notification. You could do
something like this:
SupressEvenNotificationOption seno = ....; // SupressEvenNotificationOption implements
Option
| seno.setCacheListener(MyListener.class);
| cache.put("a/b/c", "k", "v", seno);
This looks much cleaner to me and you avoid multiple method definitions in Cache API.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205679#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...