org.apache.felix.scr
注釈から注釈に移行していorg.osgi.service.component
ます。共通の抽象クラスから継承する一連のコンポーネントがあります。フェリックスの場合、スーパー クラス@Component
のオプションでアノテーションを使用してから、スーパー クラスでアノテーションを使用できます。これを osgi アノテーションに移行する方法が見つかりません。componentAbstract=true
@Reference
コンポーネントのスーパークラスでコンポーネントアノテーションを使用することは可能ですか? もしそうなら、プロパティとメタタイプの生成を処理する適切な方法は何ですか?
だから、私が探しているのは、このようなものです
/* No component definition should be generated for the parent, as it is
abstract and cannot be instantiated */
@Component(property="parent.property=parentValue")
public abstract class Parent {
@Reference
protected Service aService;
protected activate(Map<String,Object> props) {
System.out.println("I have my parent property: "+props.get("parent.property"));
@Override
public abstract void doSomething();
}
/* For this class, the proper Component definition should be generated, also
including the information coming from the annotations in the parent */
@Component(property="child.property=childValue")
public class Child extends Parent {
@Activate
public activate(Map<String,Object> props) {
super.activate(props);
System.out.println("I have my child property: "+props.get("child.property"));
}
public void doSomething() {
aService.doSomething();
}
}