public abstract class AbstractBinder extends Object implements Binder, DynamicConfiguration
| Constructor and Description |
|---|
AbstractBinder() |
| Modifier and Type | Method and Description |
|---|---|
<T> ActiveDescriptor<T> |
addActiveDescriptor(ActiveDescriptor<T> activeDescriptor) |
<T> ActiveDescriptor<T> |
addActiveDescriptor(Class<T> rawClass) |
void |
addUnbindFilter(Filter unbindFilter) |
<T> ServiceBindingBuilder<T> |
bind(Class<T> serviceType)
Start building a new class-based service binding.
|
<T> ActiveDescriptor<T> |
bind(Descriptor descriptor) |
void |
bind(DynamicConfiguration configuration) |
FactoryDescriptors |
bind(FactoryDescriptors factoryDescriptors) |
<T> ScopedBindingBuilder<T> |
bind(T service)
Start building a new instance-based service binding.
|
<T> ServiceBindingBuilder<T> |
bindAsContract(Class<T> serviceType)
Start building a new class-based service binding.
|
<T> ServiceBindingBuilder<T> |
bindAsContract(TypeLiteral<T> serviceType)
Start building a new generic type-based service binding.
|
<T> ServiceBindingBuilder<T> |
bindFactory(Class<? extends Factory<T>> factoryType)
Start building a new factory class-based service binding.
|
<T> ServiceBindingBuilder<T> |
bindFactory(Class<? extends Factory<T>> factoryType,
Class<? extends Annotation> factoryScope)
Start building a new factory class-based service binding.
|
<T> ServiceBindingBuilder<T> |
bindFactory(Factory<T> factory)
Start building a new factory instance-based service binding.
|
void |
commit() |
protected abstract void |
configure()
Implement to provide binding definitions using the exposed binding
methods.
|
void |
install(Binder... binders)
Adds all binding definitions from the binders to the binding configuration.
|
public <T> ServiceBindingBuilder<T> bind(Class<T> serviceType)
T - service type.serviceType - service class.public <T> ServiceBindingBuilder<T> bindAsContract(Class<T> serviceType)
T - service type.serviceType - service class.public <T> ServiceBindingBuilder<T> bindAsContract(TypeLiteral<T> serviceType)
T - service type.serviceType - generic service type information.public <T> ScopedBindingBuilder<T> bind(T service)
singleton-scoped.
Does NOT bind the service type itself as a contract type.T - service type.service - service instance.public <T> ServiceBindingBuilder<T> bindFactory(Class<? extends Factory<T>> factoryType, Class<? extends Annotation> factoryScope)
T - service type.factoryType - service factory class.factoryScope - factory scope.public <T> ServiceBindingBuilder<T> bindFactory(Class<? extends Factory<T>> factoryType)
per-lookup scope.T - service type.factoryType - service factory class.public <T> ServiceBindingBuilder<T> bindFactory(Factory<T> factory)
T - service type.factory - service instance.public void bind(DynamicConfiguration configuration)
protected abstract void configure()
public <T> ActiveDescriptor<T> bind(Descriptor descriptor)
This method can be called only in the execution context of the configure()
method.
bind in interface DynamicConfigurationpublic FactoryDescriptors bind(FactoryDescriptors factoryDescriptors)
This method can be called only in the execution context of the configure()
method.
bind in interface DynamicConfigurationpublic <T> ActiveDescriptor<T> addActiveDescriptor(ActiveDescriptor<T> activeDescriptor) throws IllegalArgumentException
This method can be called only in the execution context of the configure()
method.
addActiveDescriptor in interface DynamicConfigurationIllegalArgumentExceptionpublic <T> ActiveDescriptor<T> addActiveDescriptor(Class<T> rawClass) throws MultiException, IllegalArgumentException
This method can be called only in the execution context of the configure()
method.
addActiveDescriptor in interface DynamicConfigurationMultiExceptionIllegalArgumentExceptionpublic void addUnbindFilter(Filter unbindFilter) throws IllegalArgumentException
This method can be called only in the execution context of the configure()
method.
addUnbindFilter in interface DynamicConfigurationIllegalArgumentExceptionpublic void commit()
throws MultiException
This method can be called only in the execution context of the configure()
method.
commit in interface DynamicConfigurationMultiExceptionpublic final void install(Binder... binders)
binders - binders whose binding definitions should be configured.Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.