|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glassfish.hk2.utilities.ServiceLocatorUtilities
public abstract class ServiceLocatorUtilities
This is a set of useful utilities for working with ServiceLocator
.
Constructor Summary | |
---|---|
ServiceLocatorUtilities()
|
Method Summary | |
---|---|
static ActiveDescriptor<?> |
addOneDescriptor(ServiceLocator locator,
Descriptor descriptor)
It is very often the case that one wishes to add a single descriptor to a service locator. |
static ServiceLocator |
bind(Binder... binders)
This method will create or find a ServiceLocator with the name "default" and bind all of the binders given together in a single config transaction. |
static void |
bind(ServiceLocator locator,
Binder... binders)
This method will bind all of the binders given together in a single config transaction. |
static ServiceLocator |
bind(String name,
Binder... binders)
This method will create or find a ServiceLocator with the given name and bind all of the binders given together in a single config transaction. |
static void |
enablePerThreadScope(ServiceLocator locator)
This method will add the ability to use the PerThread scope to
the given locator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceLocatorUtilities()
Method Detail |
---|
public static void enablePerThreadScope(ServiceLocator locator)
PerThread
scope to
the given locator. If the locator already has a Context
implementation
that handles the PerThread
scope this method does nothing.
locator
- The non-null locator to enable the PerThread scope on
MultiException
- if there were errors when committing the servicepublic static void bind(ServiceLocator locator, Binder... binders)
locator
- The non-null locator to use for the configuration actionbinders
- The non-null list of binders to be added to the locator
MultiException
- if any error was encountered while binding servicespublic static ServiceLocator bind(String name, Binder... binders)
name
- The non-null name of the locator to use for the configuration actionbinders
- The non-null list of binders to be added to the locator
MultiException
- if any error was encountered while binding servicespublic static ServiceLocator bind(Binder... binders)
binders
- The non-null list of binders to be added to the locator
MultiException
- if any error was encountered while binding servicespublic static ActiveDescriptor<?> addOneDescriptor(ServiceLocator locator, Descriptor descriptor)
ActiveDescriptor
and is reified, it will be added as an
ActiveDescriptor
. Otherwise it will be bound as a Descriptor
.
locator
- The non-null locator to add this descriptor todescriptor
- The non-null descriptor to add to this locator
MultiException
- On a commit failure
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |