Here is my code (simplified but working), it's a calculation engine, pilot by applying rules in certain orders:
class Rule1 implements IRule{
doSomethingMethod () {}
}
class Rule2 implements IRule{
doSomethingMethod () {}
}
...
class Engine1 () {
Rule1.doSomething();
Rule2.doSomething();
}
class Engine2 () {
Rule3.doSomething();
Rule99.doSomething();
Rule5.doSomething();
}
I would like to code this with custom Annotations, because my goal is to make statistics from which engines call which rules, and I think it will be more easy:
public @Interface Rule (){
class Rule rule;
}
class Engine1 () {
@Rule(Rule1.class);
@Rule(Rule2.class);
}
class Engine2 () {
@Rule(Rule3.class);
@Rule(Rule99.class);
@Rule(Rule5.class);
}
Then I could maybe scan with org.springframework.context.annotation.ClassPathScanningCandidateCom to make statistics more easy.
Is this possible (and how?) ? Is this the goodway to do ? I there another way ?