Interface Dependency

  • All Known Implementing Classes:
    ClassDependency, ConstantBeanProvider, NameDependency

    public interface Dependency

    Definition of an interface for describing a dependency to another BeanProvider in an abstract way.

    BeanProviders often depend on other providers, e.g. some properties of the bean to be created need to be initialized with other beans. There are different ways of defining such dependencies: by specifying the name of the dependent bean, by specifying its class, etc. This interface provides a generic way of defining dependencies. It has a resolve() method that can be implemented in a suitable way.

    Version:
    $Id: Dependency.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • resolve

        BeanProvider resolve​(BeanStore store,
                             DependencyProvider depProvider)
        Resolves this dependency starting from the specified BeanStore. A concrete implementation has to search for the BeanProvider it depends on. If necessary, the given bean store's parent has to be searched recursively. The DependencyProvider can be used for querying further information about the current context, e.g. for resolving classes using predefined class loaders.
        Parameters:
        store - the current bean store
        depProvider - the dependency provider
        Returns:
        the resolved bean
        Throws:
        InjectionException - if resolving of the dependency fails