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

toothpick.compiler.registry.targets.RegistryInjectionTarget Maven / Gradle / Ivy

There is a newer version: 3.1.0
Show newest version
package toothpick.compiler.registry.targets;

import java.util.List;
import javax.lang.model.element.TypeElement;
import toothpick.compiler.registry.generators.RegistryGenerator;
import toothpick.registries.FactoryRegistry;
import toothpick.registries.MemberInjectorRegistry;

/**
 * Stores the information needed by {@link RegistryGenerator} to generate a Registry.
 *
 * @see {@link FactoryRegistry} and {@link MemberInjectorRegistry} for Registry types.
 */
public class RegistryInjectionTarget {

  private static final String REGISTRY_NAME = "%sRegistry";
  private static final String GETTER_NAME = "get%s";
  private static final String CHILDREN_GETTER_NAME = "get%sInChildrenRegistries";

  public Class type; // Factory.class
  public Class superClass; // toothpick.registries.factory.AbstractFactoryRegistry
  public String packageName;
  public List childrenRegistryPackageNameList;
  public List injectionTargetList;

  public String registryName;
  public String getterName;
  public String childrenGetterName;

  public RegistryInjectionTarget(Class type, Class superClass, String packageName,
      List childrenRegistryPackageNameList, List injectionTargetList) {
    this.type = type;
    this.superClass = superClass;
    this.packageName = packageName;
    this.childrenRegistryPackageNameList = childrenRegistryPackageNameList;
    this.injectionTargetList = injectionTargetList;

    String typeSimpleName = type.getSimpleName();
    this.registryName = String.format(REGISTRY_NAME, typeSimpleName);
    this.getterName = String.format(GETTER_NAME, typeSimpleName);
    this.childrenGetterName = String.format(CHILDREN_GETTER_NAME, typeSimpleName);
  }

  public String getFqcn() {
    return packageName + "." + registryName;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy