use of org.hudsonci.inject.internal.plugin.PluginClassLoader in project hudson-2.x by hudson.
the class InjectomaticImpl method inject.
public void inject(final Object component) {
checkNotNull(component);
Class type = component.getClass();
if (!isInjectable(type)) {
log.trace("Type not injectable; skipping: {}", type);
return;
}
// Find the injector for the component
ClassLoader tmp = type.getClassLoader();
Injector injector;
// If the component belongs to a plugin, then use the plugin's injector
if (tmp instanceof PluginClassLoader) {
PluginClassLoader cl = (PluginClassLoader) tmp;
injector = container.injector(cl.getPlugin());
} else {
// Use the root injector if we did not load from a plugin
injector = ((SmoothieContainerImpl) container).rootInjector();
}
if (log.isTraceEnabled()) {
log.trace("Injecting: {}", OID.get(component));
}
injector.injectMembers(component);
}
Aggregations