Class ProvidesResolver

java.lang.Object
build.codemodel.dependency.injection.ProvidesResolver
All Implemented Interfaces:
Resolver<Object>

public class ProvidesResolver extends Object implements Resolver<Object>
A Resolver of values produced by Provides-annotated methods on a provider object.

At construction, the provider object's type descriptor hierarchy is scanned via the InjectionFramework for non-static, non-abstract, non-void, no-arg methods annotated with Provides. Each such method's return type is registered as a resolvable type. At resolve time, the matching method is invoked and its return value is wrapped in a ValueBinding.

Each call to resolve(Dependency) invokes the Provides method afresh, giving factory-per-resolution semantics (analogous to an unscoped binding in Dagger/Guice). If singleton semantics are required, the provider object should memoize the value itself.

Author:
reed.vonredwitz
See Also: