
toothpick.locators.MemberInjectorLocator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toothpick-runtime Show documentation
Show all versions of toothpick-runtime Show documentation
'Main Toothpick implementation'
package toothpick.locators;
import toothpick.MemberInjector;
/**
* Locates the {@link MemberInjector} instances.
* If not {@link MemberInjector} is found, we simply return {@code null}.
* This is required to fully support polymorphism when injecting dependencies.
*
* @see MemberInjector
*/
public class MemberInjectorLocator {
private MemberInjectorLocator() {
}
public static MemberInjector getMemberInjector(Class clazz) {
try {
Class extends MemberInjector> memberInjectorClass =
(Class extends MemberInjector>) Class.forName(clazz.getName() + "__MemberInjector");
return memberInjectorClass.newInstance();
} catch (Exception e) {
return null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy