![JAR search and dependency download from the Maven repository](/logo.png)
com.github.henryco.injector.Container Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grinjector Show documentation
Show all versions of grinjector Show documentation
Lightweight reflective dependency injector for java.
package com.github.henryco.injector;
import com.github.henryco.injector.meta.ModuleStruct;
import java.util.HashSet;
import java.util.Set;
/**
* Created 12/15/2017
*
* @author Henry
*/
public final class Container {
/*package*/ final Set modules;
Container() {
modules = new HashSet<>();
}
void addModules(ClassLoader classLoader, Class> ... modules) {
for (Class> module : modules) {
if (this.modules.stream().anyMatch(m -> m.getModule().getName().equals(module.getName())))
continue;
this.modules.add(new ModuleStruct(module, classLoader));
}
}
void setClassLoader(ClassLoader classLoader) {
for (ModuleStruct module : modules) {
module.setClassLoader(classLoader);
}
}
void reset() {
modules.clear();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy