Added generics to factories.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1477245 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
index 517a003..edf08c1 100644
--- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
+++ b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java
@@ -76,19 +76,20 @@
}
}
- public String getClassName() { return "composite"; }
+ public String getClassName() { return null; }
/**
* Compute required handlers.
* @return the list of required handler.
*/
- public List getRequiredHandlerList() {
- List list = new ArrayList();
+ public List<RequiredHandler> getRequiredHandlerList() {
+ List<RequiredHandler> list = new ArrayList<RequiredHandler>();
Element[] elems = m_componentMetadata.getElements();
- for (int i = 0; i < elems.length; i++) {
- Element current = elems[i];
+ for (Element current : elems) {
RequiredHandler req = new RequiredHandler(current.getName(), current.getNameSpace());
- if (! list.contains(req)) { list.add(req); }
+ if (!list.contains(req)) {
+ list.add(req);
+ }
}
// Add architecture if architecture != 'false'
@@ -126,7 +127,6 @@
} catch (InvalidSyntaxException e) {
m_logger.log(Logger.ERROR, "A factory filter is not valid: " + e.getMessage());
stop();
- return;
}
}
}
@@ -165,7 +165,7 @@
name = (String) properties.get("name");
}
- ComponentInstance instance = (ComponentInstance) m_componentInstances.get(name);
+ ComponentInstance instance = m_componentInstances.get(name);
if (instance == null) { // The instance does not exists.
return;
}
diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java
index 1fe3a10..3ed565e 100644
--- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java
+++ b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java
@@ -181,7 +181,7 @@
public CompositeHandler getCompositeHandler(String name) {
for (int i = 0; i < m_handlers.length; i++) {
HandlerFactory fact = (HandlerFactory) m_handlers[i].getFactory();
- if (fact.getHandlerName().equals(name) || fact.getComponentDescription().getClassName().equals(name)) {
+ if (fact.getHandlerName().equals(name) || name.equals(fact.getComponentDescription().getClassName())) {
return (CompositeHandler) m_handlers[i].getHandler();
}
}
diff --git a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
index cf7199d..efacda5 100644
--- a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
+++ b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java
@@ -290,7 +290,7 @@
*
* @return the required handler list.
*/
- public List getRequiredHandlerList() {
+ public List<RequiredHandler> getRequiredHandlerList() {
List<RequiredHandler> list = new ArrayList<RequiredHandler>();
Element[] elems = m_componentMetadata.getElements();
for (Element current : elems) {
diff --git a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
index cf5994e..f8c1ed0 100644
--- a/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
+++ b/ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java
@@ -155,8 +155,8 @@
* and a handler is never immediate.
* @return the required handler list.
*/
- public List getRequiredHandlerList() {
- List list = new ArrayList();
+ public List<RequiredHandler> getRequiredHandlerList() {
+ List<RequiredHandler> list = new ArrayList<RequiredHandler>();
Element[] elems = m_componentMetadata.getElements();
for (int i = 0; i < elems.length; i++) {
Element current = elems[i];