All Downloads are FREE. Search and download functionalities are using the official Maven repository.

toothpick.locators.MemberInjectorLocator Maven / Gradle / Ivy

There is a newer version: 3.1.0
Show newest version
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> memberInjectorClass =
                  (Class>) Class.forName(clazz.getName() + "__MemberInjector");
          return memberInjectorClass.newInstance();
      } catch (Exception e) {
          return null;
      }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy