ServiceLocator.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final Immediate | |
| private static final InheritableThread | |
| private static final PerLookup | |
| private static final PerThread | |
| private static final Singleton |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static List | Returns: The list of descriptors added to the system. Will not return null but may return an empty listThe non-null locator to add this descriptor to locator, boolean idempotent, Class<?>... The classes to add to the locator. If a class in this list implements
toAdd)Factory then two descriptors will be added for that classIt is very often the case that one wishes to add classes that hk2 will automatically analyze for contracts and qualifiers to a service locator. |
| public static List | Returns: The list of descriptors added to the system. Will not return null but may return an empty listThe non-null locator to add this descriptor to locator, Class<?>... The classes to add to the locator. If a class in this list implements
toAdd)Factory then two descriptors will be added for that classIt is very often the case that one wishes to add classes that hk2 will automatically analyze for contracts and qualifiers to a service locator. |
| public static List | Returns: The descriptors that were added to the service locator. Will not return null, but may return an empty list (if the constants array was zero length)The non-null locator to add these factory constants to locator, Factory<?>... The constant factories to add to the locator. None of the constants
in this array may be null constants)This method adds factory constants to the given locator. |
| public static List | Returns: a list of the FactoryDescriptor descriptors that were added to the service locatorThe locator to add the factories to. May not be null locator, FactoryDescriptors... The list of factory descriptors to add to the system. May not be null factories)Adds the given factory descriptors to the service locator |
| public static List | Returns: A list of the FactoryDescriptor descriptors that were added to the service locatorThe locator to add the factories to. May not be null locator, boolean This is false ONLY if every one of the factories given to this method can be used without a copy requiresDeepCopy, FactoryDescriptors... The list of factory descriptors to add to the system. May not be null factories)Adds the given factory descriptors to the service locator |
| public static <T> ActiveDescriptor | Returns: The descriptor that was added to the service locatorThe non-null locator to add this descriptor to locator, Object The non-null constant to add to the service locator constant)This method adds one existing object to the given service locator. |
| public static <T> ActiveDescriptor | Returns: The descriptor that was added to the service locatorThe non-null locator to add this descriptor to locator, Object The non-null constant to add to the service locator constant, String The name this descriptor should take (may be null) name, Type... The full set of contracts this descriptor should take. If this
field is the empty set then the contracts will be automatically discovered contracts)This method adds one existing object to the given service locator. |
| public static <T> ActiveDescriptor | Returns: The descriptor that was added to the systemThe non-null locator to add this descriptor to locator, Descriptor The non-null descriptor to add to this locator descriptor)It is very often the case that one wishes to add a single descriptor to a service locator. |
| public static <T> ActiveDescriptor | Returns: The descriptor that was added to the systemThe non-null locator to add this descriptor to locator, Descriptor The non-null descriptor to add to this locator descriptor, boolean If true a deep copy will be made of the
key. If false then the Descriptor will be used as is, and it
is the responsibility of the caller to ensure that the fields
of the Descriptor never change (with the exception of any
writeable fields, such as ranking) requiresDeepCopy)It is very often the case that one wishes to add a single descriptor to a service locator. |
| public static void | bind(ServiceLocator
The non-null locator to use for the configuration action locator, Binder... The non-null list of binders to be added to the locator binders)This method will bind all of the binders given together in a single config transaction. |
| public static ServiceLocator | Returns: The service locator that was either found or createdThe non-null name of the locator to use for the configuration action name, Binder... The non-null list of binders to be added to the locator 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. |
| public static ServiceLocator | |
| public static ServiceLocator | Returns: A service locator that has been populated with servicesThe name of the service locator to create. If there is already a service
locator of this name this method will use that one to populate. If this is null
a randomly assigned name will be given to the service locator, and it will not be
tracked by the system. If this is NOT null then this service locator can be found
with name)ServiceLocatorFactory#find(String).This method is often the first line of a stand-alone client that wishes to use HK2. |
| public static ServiceLocator | Returns: A service locator that has been populated with servicesThis method is often the first line of a stand-alone client that wishes to use HK2. |
| public static DynamicConfiguration | Returns: A non-null DynamicConfiguration object that can be used to add or remove services to the passed in locatorA non-null locator to get a DynamicConfiguration for locator)This method returns a |
| public static void | dumpAllDescriptors(ServiceLocator
The non-null locator to dump to stderr locator)Dumps all descriptors in this ServiceLocator to stderr |
| public static void | dumpAllDescriptors(ServiceLocator
The non-null locator to dump locator, PrintStream The non-null PrintStream to print the descriptors to output)Dumps all descriptors in this ServiceLocator to the given PrintStream |
| public static void | enableGreedyResolution(ServiceLocator
The locator to enable for greedy resolution locator)Enables greedy service resolution in this service locator by
adding the |
| public static void | enableImmediateScope(ServiceLocator
The non-null locator to enable the Immediate scope on locator)This method will add the ability to use the |
| public static ImmediateController | Returns: The ImmediateController that can be used to further configure the Immediate scopeThe non-null locator to enable the Immediate scope on locator)This method will add the ability to use the |
| public static void | enableInheritableThreadScope(ServiceLocator
The non-null locator to enable the PerThread scope on locator)This method will add the ability to use the |
| public static void | enableLookupExceptions(ServiceLocator
The service locator to enable lookup exceptions on. May not be null locator)This method will cause lookup operations to throw exceptions when exceptions are encountered in underlying operations such as classloading. |
| public static void | enablePerThreadScope(ServiceLocator
The non-null locator to enable the PerThread scope on locator)This method will add the ability to use the |
| public static <T> ActiveDescriptor | Returns: The descriptor as found in the locator, or null if no such descriptor could be foundThe non-null locator in which to find the descriptor locator, Descriptor The non-null descriptor to search for descriptor)Finds a descriptor in the given service locator. |
| public static <T> T | Returns: An instance of type as either found in the locator or automatically created, injected and post-constructed. Note that the return value CAN be null IF the service was found in the service locator and the context in which the service is in allows for null services.The service locator to search for the service with locator, Class<T> The non-null type of object to either find or create type, Annotation... The set of qualifiers that should be associated with the service qualifiers)This method will first attempt to find a service corresponding to the type and qualifiers passed in to the method, and if one is found simply returns it. |
| pack-priv static String | |
| public static Immediate | |
| public static InheritableThread | |
| public static String | Returns: The first value in the given field, or null if no such field exists in the descriptorThe non-null descriptor from which to get the first value in the given field d, String The non-null field to get the first value of field)Gets one value from a metadata field from the given descriptor |
| public static String | Returns: The first value in the given field, or null if no such field exists in the descriptorThe non-null service handle from which to get the first value in the given field h, String The non-null field to get the first value of field)Gets one value from a metadata field from the given service handle |
| public static PerLookup | |
| public static PerThread | |
| public static <T> T | Returns: The found service, or null if there is no service with this class nameThe locator to find the service in locator, String The fully qualified class name of the service className)Returns the best service matching the passed in fully qualified class name of the service |
| public static <T> T | Returns: The service objectThe non-null locator in which to get the service associated with
this descriptor locator, Descriptor The non-null descriptor to find the corresponding service for descriptor)Returns the service in this service locator given the current descriptor. |
| public static Singleton | |
| private static boolean | |
| public static void | removeFilter(ServiceLocator
The non-null locator to remove the descriptors from locator, Filter The non-null filter which will determine what descriptors to remove filter)Removes all the descriptors from the given locator that match the given filter |
| public static void | removeFilter(ServiceLocator
The non-null locator to remove the descriptors from locator, Filter The non-null filter which will determine what descriptors to remove filter, boolean If set to true all includeAliasDescriptors)AliasDescriptors that point
to any descriptors found by filter will also be removedRemoves all the descriptors from the given locator that match the given filter |
| public static void | removeOneDescriptor(ServiceLocator
The non-null locator to remove the descriptor from locator, Descriptor The non-null descriptor to remove from the locator descriptor)This method will attempt to remove descriptors matching the passed in descriptor from the given locator. |
| public static void | removeOneDescriptor(ServiceLocator
The non-null locator to remove the descriptor from locator, Descriptor The non-null descriptor to remove from the locator descriptor, boolean If set to true all includeAliasDescriptors)AliasDescriptors that point
to any descriptors found by filter will also be removedThis method will attempt to remove descriptors matching the passed in descriptor from the given locator. |