Following some principles that say that software (especially business logic) should be "framework independent", I would like to know if it is possible to apply some wrapper / adapter in libraries that are based on Annotations?
We can take as an example, in JAVA the OSGi Declarative Services (DS) Annotations framewor, which uses annotations to create "Components" and use, and abuse Dependecy Injection.
@Component(name = "Example", scope = ServiceScope.SINGLETON, service = ExampleSomething.class, immediate = true)
class Example implements ExampleSomething {
@Override
public void doSomething() {
}
}
interface ExampleSomething {
void doSomething();
}
@Component(name = "ExampleRef", scope = ServiceScope.SINGLETON, service = ExampleSomethingToRef.class, immediate = true)
class ExampleRef implements ExampleSomethingToRef {
@Reference
ExampleSomething exampleSomething;
@Activate
void onInit(Map<String, Object> properties) {
}
@Override
public void makeSomething() {
}
}
interface ExampleSomethingToRef {
void makeSomething();
}
Aucun commentaire:
Enregistrer un commentaire