M
Meidos
I have an interface as follows:
interface Handler<A extends Annotation> {
handle(A annotation);
}
I have a single implementation for each type of supported annotation.
The annotations are applied to methods in interfaces, and a dynamic
proxy is used to implement the actual method. In order to determine
which Handler to use for a method, I look at it's annotation, and pick
the handler from a map:
Map<Class<? extends Annotation>, Handler<?>> handlerMap;
handlerMap.put(SomeAnnotation.class, new SomeAnnotationHandler());
The problem is that when I get the Handler from the map, it will be a
Handler of type Handler<? extends Annotation>, and I cannot call
handle() on it because the type is unspecified. How can I solve this?
interface Handler<A extends Annotation> {
handle(A annotation);
}
I have a single implementation for each type of supported annotation.
The annotations are applied to methods in interfaces, and a dynamic
proxy is used to implement the actual method. In order to determine
which Handler to use for a method, I look at it's annotation, and pick
the handler from a map:
Map<Class<? extends Annotation>, Handler<?>> handlerMap;
handlerMap.put(SomeAnnotation.class, new SomeAnnotationHandler());
The problem is that when I get the Handler from the map, it will be a
Handler of type Handler<? extends Annotation>, and I cannot call
handle() on it because the type is unspecified. How can I solve this?