org.apache.cayenne.di
Interface BindingBuilder<T>

Type Parameters:
T - An interface type of the service being bound.

public interface BindingBuilder<T>

A binding builder that helps with fluent binding creation.

Since:
3.1

Method Summary
 void in(Scope scope)
          Sets the scope of a bound instance.
 void inSingletonScope()
          Sets the scope of a bound instance to singleton.
 BindingBuilder<T> to(java.lang.Class<? extends T> implementation)
           
 BindingBuilder<T> toInstance(T instance)
           
 BindingBuilder<T> toProvider(java.lang.Class<? extends Provider<? extends T>> providerType)
           
 BindingBuilder<T> toProviderInstance(Provider<? extends T> provider)
           
 void withoutScope()
          Sets the scope of a bound instance to "no scope".
 

Method Detail

to

BindingBuilder<T> to(java.lang.Class<? extends T> implementation)
                     throws ConfigurationException
Throws:
ConfigurationException

toInstance

BindingBuilder<T> toInstance(T instance)
                             throws ConfigurationException
Throws:
ConfigurationException

toProvider

BindingBuilder<T> toProvider(java.lang.Class<? extends Provider<? extends T>> providerType)
                             throws ConfigurationException
Throws:
ConfigurationException

toProviderInstance

BindingBuilder<T> toProviderInstance(Provider<? extends T> provider)
                                     throws ConfigurationException
Throws:
ConfigurationException

in

void in(Scope scope)
Sets the scope of a bound instance. This method is used to change the default scope which is usually a singleton to a custom scope.


inSingletonScope

void inSingletonScope()
Sets the scope of a bound instance to singleton. Singleton is normally the default, so calling this method explicitly is rarely needed.


withoutScope

void withoutScope()
Sets the scope of a bound instance to "no scope". This means that a new instance of an object will be created on every call to Injector.getInstance(Class).



Copyright © 2001-2012 Apache Cayenne. All Rights Reserved.