
org.meridor.stecker.impl.ClassesRegistry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of stecker-plugin-loader Show documentation
Show all versions of stecker-plugin-loader Show documentation
This is a plugin loading library. Its main purpose is to load extension point implementations from
provided plugins.
package org.meridor.stecker.impl;
import org.meridor.stecker.interfaces.PluginImplementationsAware;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ClassesRegistry implements PluginImplementationsAware {
private final Map> contents = new HashMap<>();
public ClassesRegistry(Map> contents) {
for (Class extensionPoint : contents.keySet()) {
addImplementations(extensionPoint, contents.get(extensionPoint));
}
}
public ClassesRegistry(Class extensionPoint, List implementationClasses) {
addImplementations(extensionPoint, implementationClasses);
}
public List getImplementations(Class extensionPoint) {
return contents.containsKey(extensionPoint) ?
contents.get(extensionPoint) : Collections.emptyList();
}
public void addImplementations(Class extensionPoint, List implementationClasses) {
if (!contents.containsKey(extensionPoint)) {
contents.put(extensionPoint, new ArrayList<>());
}
contents.get(extensionPoint).addAll(implementationClasses);
}
public List getExtensionPoints() {
return new ArrayList<>(contents.keySet());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy