I am creating a web application and I am injecting a SystemManager
interface in it. All of my business logic resides behind it and pages just have to request data from it. I would like to create a generic implementation which would get a method signature and based on the annotation it would invoke the correct method in the system.
The implementation of this interface acts like a facade pattern - it just calls methods on different objects.
The current implementation is
SystemManager.java
void executeA();
void executeB();
SystemManagerImpl.java
void executeA(){
SystemA.exectueA();
}
void executeB(){
SystemB.exectueB();
}
But I would like to replace it with some generic solution like
SystemManager.java
@SystemA
void executeA();
@SystemB
void executeB();
SystemManagerImpl.java
void genericMethod(){
// based on the annotation of the method received I am calling correct System class and invoking correct method
}
I dont think this is possible but still I am open to suggestions.