[jboss-dev-forums] [Design of POJO Server] - Re: Leaking annotation API
adrian@jboss.org
do-not-reply at jboss.com
Tue Oct 23 09:17:58 EDT 2007
It looks to me like this just needs an indirection to use a factory?
If you change the @Cache to be something like:
| public @interface Cache
| {
| Class<? extends CacheFactory> value();
| }
|
with the CacheFactory being
| public interface CacheFactory
| {
| CacheInterface createCache();
| }
|
Then you don't need the implementation classes on the client.
You would need the implementation of the factory on the client
(e.g. NoPassivationFactory) but not the cache implementation itself.
In fact, in my testing, you don't even need the "CacheInterface" class
on the client (at least with Sun's JDK?). It can still read the annotation
without loading the classes on the CacheFactory methods.
The other obvious alternative is to change the annotation to use a String
but like you said this looses type safety.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4097882#4097882
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4097882
More information about the jboss-dev-forums
mailing list