commit | 625cbda789b95a1098a5ecad7bcc2dcb9cd1c29e | [log] [tgz] |
---|---|---|
author | Pierre De Rop <pderop@apache.org> | Thu Mar 04 07:20:26 2010 +0000 |
committer | Pierre De Rop <pderop@apache.org> | Thu Mar 04 07:20:26 2010 +0000 |
tree | 3970b2059ea490cd58495e14a0290aa3ff68701d | |
parent | 8c745b287fd6d53e9ccb2c5506794ee9cdde2651 [diff] |
added factory and factoryMethod attributes in AspectService annotation git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@918879 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java index ea8b242..5836e4f 100644 --- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java +++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AspectService.java
@@ -62,4 +62,18 @@ * @return the ranking of this aspect */ int ranking(); + + /** + * Returns the Class of the class which acts as a factory for this Service. The default method + * factory name is "create". If you need to invoke another method, then you can use the + * <code>factoryMethod</code> attribute. + * @return the factory Class name. + */ + Class<?> factory() default Object.class; + + /** + * Returns the method name of the factory class which will create our Service instance. + * @return the factory method name. + */ + String factoryMethod() default ""; }
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java index 43f6f4a..db8754d 100644 --- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java +++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
@@ -610,6 +610,12 @@ // Register previously parsed Init/Start/Stop/Destroy/Composition annotations addInitStartStopDestroyCompositionParams(info); + // factory attribute + info.addClassParam(annotation, Params.factory, null); + + // factoryMethod attribute + info.addParam(annotation, Params.factoryMethod, null); + // Parse service filter String filter = annotation.get(Params.filter.toString()); if (filter != null) {