Class DependencyGraph

java.lang.Object
de.simonkerstan.ee.core.di.graph.DependencyGraph

public final class DependencyGraph extends Object
Graph with all beans and their dependencies.
  • Constructor Details

    • DependencyGraph

      public DependencyGraph()
  • Method Details

    • addBean

      public void addBean(int priority, Class<?> type, BeanCreationInformation beanCreationInformation)
      Add a bean to the graph. The graph will automatically resolve all possible types that could be provided by the bean.
      Parameters:
      priority - Priority of the bean
      type - Type of the bean
      beanCreationInformation - Bean information
    • addDefaultConstructorClass

      public void addDefaultConstructorClass(Class<?> clazz, Class<?>[] interfaces)
      Add a class with a default constructor to the list of classes with a default constructor.
      Parameters:
      clazz - Class with a default constructor
      interfaces - Directly implemented interfaces of the given class
    • hasUnresolvedDependencies

      public boolean hasUnresolvedDependencies()
      Test whether the graph has unresolved dependencies.
      Returns:
      true if there are unresolved dependencies, false otherwise.
    • instantiateBeans

      public Map<Class<?>,Object> instantiateBeans() throws BeanInstantiationException
      Instantiate all beans in the graph.
      Returns:
      Map of instantiated beans
      Throws:
      BeanInstantiationException - If instantiation fails for one of the beans or dependencies are unresolvable