de.intarsys.tools.factory.StandardOutlet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isrt Show documentation
Show all versions of isrt Show documentation
The basic runtime tools and interfaces for intarsys components.
package de.intarsys.tools.factory;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class StandardOutlet implements IOutlet {
private Map factories = new HashMap();
public IFactory[] getFactories() {
return factories.values().toArray(new IFactory[factories.size()]);
}
public IFactory[] lookupFactories(Class type) {
Set result = new HashSet();
for (IFactory factory : factories.values()) {
Class resultType = factory.getResultType();
if (resultType != null && type.isAssignableFrom(resultType)) {
result.add(factory);
}
}
return result.toArray(new IFactory[result.size()]);
}
public IFactory lookupFactory(String id) {
return factories.get(id);
}
public void registerFactory(IFactory factory) {
factories.put(factory.getId(), factory);
}
public void unregisterFactory(IFactory factory) {
factories.remove(factory.getId());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy