|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.hk2.utilities.binding.AbstractBinder
public abstract class AbstractBinder
Skeleton implementation of injection binder with convenience methods for binding definitions.
| Constructor Summary | |
|---|---|
AbstractBinder()
|
|
| Method Summary | ||
|---|---|---|
|
addActiveDescriptor(ActiveDescriptor<T> activeDescriptor)
This allows third party systems to add reified active descriptors to the system. |
|
|
addActiveDescriptor(java.lang.Class<T> rawClass)
This adds an active descriptor to the system based completely on the analysis of the given class. |
|
void |
addUnbindFilter(Filter unbindFilter)
This filter will added to the list of filters in this Configuration that will determine which Descriptors will be removed from the system. |
|
|
bind(java.lang.Class<T> serviceType)
Start building a new class-based service binding. |
|
|
bind(Descriptor descriptor)
This method will bind the given descriptor to this Module. |
|
void |
bind(DynamicConfiguration configuration)
This method will be called by the ServiceLocatorUtilities.bind(org.glassfish.hk2.api.ServiceLocator, Binder...) method for each
binder given. |
|
FactoryDescriptors |
bind(FactoryDescriptors factoryDescriptors)
This method will bind the descriptors found in the FactoryDescriptors. |
|
|
bind(T service)
Start building a new instance-based service binding. |
|
|
bindAsContract(java.lang.Class<T> serviceType)
Start building a new class-based service binding. |
|
|
bindAsContract(TypeLiteral<T> serviceType)
Start building a new generic type-based service binding. |
|
|
bindFactory(java.lang.Class<? extends Factory<T>> factoryType)
Start building a new factory class-based service binding. |
|
|
bindFactory(java.lang.Class<? extends Factory<T>> factoryType,
java.lang.Class<? extends java.lang.annotation.Annotation> factoryScope)
Start building a new factory class-based service binding. |
|
|
bindFactory(Factory<T> factory)
Start building a new factory instance-based service binding. |
|
void |
commit()
This causes the configuration to get committed. |
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractBinder()
| Method Detail |
|---|
public <T> ServiceBindingBuilder<T> bind(java.lang.Class<T> serviceType)
T - service type.serviceType - service class.
public <T> ServiceBindingBuilder<T> bindAsContract(java.lang.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(java.lang.Class<? extends Factory<T>> factoryType,
java.lang.Class<? extends java.lang.annotation.Annotation> factoryScope)
T - service type.factoryType - service factory class.factoryScope - factory scope.
public <T> ServiceBindingBuilder<T> bindFactory(java.lang.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)
BinderServiceLocatorUtilities.bind(org.glassfish.hk2.api.ServiceLocator, Binder...) method for each
binder given. All of the updates will be committed as one commit operation.
bind in interface Binderconfiguration - The non-null config to bind service references intoprotected 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 DynamicConfigurationdescriptor - May not be null. Will be used to derive the various
key fields associated with the given provider
public FactoryDescriptors bind(FactoryDescriptors factoryDescriptors)
FactoryDescriptors. This method will first
validate the descriptors from the FactoryDescriptors
and then simply bind them into this configuration as
two independent descriptors.
This method can be called only in the execution context of the configure()
method.
bind in interface DynamicConfigurationfactoryDescriptors - A description of a factory service
and the type the factory service provides. May not be null
public <T> ActiveDescriptor<T> addActiveDescriptor(ActiveDescriptor<T> activeDescriptor)
throws java.lang.IllegalArgumentException
This method can be called only in the execution context of the configure()
method.
addActiveDescriptor in interface DynamicConfigurationactiveDescriptor - The reified active descriptor to be added to the system. The
system will not attempt to reify this descriptor itself
java.lang.IllegalArgumentException - if the descriptor is not reified
public <T> ActiveDescriptor<T> addActiveDescriptor(java.lang.Class<T> rawClass)
throws MultiException,
java.lang.IllegalArgumentException
This method can be called only in the execution context of the configure()
method.
addActiveDescriptor in interface DynamicConfigurationrawClass - The class to analyze, must not be null
MultiException - If this class cannot be a service
java.lang.IllegalArgumentException - if rawClass is null
public void addUnbindFilter(Filter unbindFilter)
throws java.lang.IllegalArgumentException
ActiveDescriptor. The descriptors passed into this
filter may or may not have been reified. This filter should not reify passed in descriptors.
And descriptor for which this filter returns true will be removed from the
ServiceLocator prior to any additions that are performed with this
Configuration object. Hence a Configuration can remove and add a descriptor of the
same type in one commit.
In order to unbind a filter the caller of commit must pass the LOOKUP validators and the UNBIND validators.
This method can be called only in the execution context of the configure()
method.
addUnbindFilter in interface DynamicConfigurationunbindFilter - This filter will be added to the list of filters that this
configuration object will use to determine which descriptors to unbind from the system.
May not be null
java.lang.IllegalArgumentException - if unbindFilter is null
public void commit()
throws MultiException
This method can be called only in the execution context of the configure()
method.
commit in interface DynamicConfigurationMultiException - If errors were found in the commit processpublic final void install(Binder... binders)
binders - binders whose binding definitions should be configured.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||