org.glassfish.hk2.deprecated.utilities
Class Utilities

java.lang.Object
  extended by org.glassfish.hk2.deprecated.utilities.Utilities

Deprecated.

@Deprecated
public class Utilities
extends Object

Core utilities.

Author:
tbeerbower

Constructor Summary
Utilities()
          Deprecated.  
 
Method Summary
static ActiveDescriptor<?> add(ServiceLocator locator, Descriptor descriptor)
          Deprecated. Bind the given descriptor to the given service locator.
static
<T> void
addIndex(ServiceLocator locator, ActiveDescriptor<T> descriptor, String contract, String name)
          Deprecated. Add an alternate index to look up the given descriptor.
static DescriptorImpl createDescriptor(String typeName, HK2Loader cl, Map<String,List<String>> metadata)
          Deprecated. Create a descriptor from the given type name.
static List<? extends Descriptor> getAllDescriptorsByContract(ServiceLocator locator, Class type)
          Deprecated. Get all of the descriptors for the given contract type.
static Descriptor getDescriptor(ServiceLocator locator, Class type, String name)
          Deprecated. Get the best descriptor for the given class and name.
static
<T> Inhabitant<T>
getInhabitantFromActiveDescriptor(ActiveDescriptor<T> fromMe, ServiceLocator locator)
          Deprecated. Creates an Inhabitant from an ActiveDescriptor.
<T> T
getService(ServiceLocator locator, Descriptor descriptor)
          Deprecated. Get the service from the given service locator for the given descriptor.
protected static Type getTypeClosure(Type ofType, String contract)
          Deprecated. Returns the type closure for the given contract.
static boolean remove(ServiceLocator locator, Filter filter)
          Deprecated. Unbind the descriptor(s) found by the given filter from the given service locator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utilities

public Utilities()
Deprecated. 
Method Detail

add

public static ActiveDescriptor<?> add(ServiceLocator locator,
                                      Descriptor descriptor)
Deprecated. 
Bind the given descriptor to the given service locator.

Parameters:
locator - the service locator to bind to
descriptor - the descriptor that we are adding

addIndex

public static <T> void addIndex(ServiceLocator locator,
                                ActiveDescriptor<T> descriptor,
                                String contract,
                                String name)
Deprecated. 
Add an alternate index to look up the given descriptor.

Type Parameters:
T - the descriptor type
Parameters:
locator - the service locator to associate this index with
descriptor - the descriptor that we are adding the index for
contract - the contract for the index
name - the name for the index

remove

public static boolean remove(ServiceLocator locator,
                             Filter filter)
Deprecated. 
Unbind the descriptor(s) found by the given filter from the given service locator.

Parameters:
locator - the service locator
filter - the filter used to find descriptor(s) that we are unbinding
Returns:
true if any descriptor(s) could be found using the given filter; false otherwise

createDescriptor

public static DescriptorImpl createDescriptor(String typeName,
                                              HK2Loader cl,
                                              Map<String,List<String>> metadata)
Deprecated. 
Create a descriptor from the given type name.

Parameters:
typeName - the type name
cl - the loader
metadata - the metadata
Returns:
a new descriptor

getTypeClosure

protected static Type getTypeClosure(Type ofType,
                                     String contract)
Deprecated. 
Returns the type closure for the given contract.

Parameters:
ofType - the type to check
contract - the contract this type is allowed to handle
Returns:
the type closure restricted to the contract; null if the given type does not implement the given contract

getInhabitantFromActiveDescriptor

public static <T> Inhabitant<T> getInhabitantFromActiveDescriptor(ActiveDescriptor<T> fromMe,
                                                                  ServiceLocator locator)
Deprecated. 
Creates an Inhabitant from an ActiveDescriptor.

Parameters:
fromMe - the Descriptor to turn into an Inhabitant
locator - the locator to use for the Inhabitant
Returns:
an Inhabitant

getDescriptor

public static Descriptor getDescriptor(ServiceLocator locator,
                                       Class type,
                                       String name)
Deprecated. 
Get the best descriptor for the given class and name.

Parameters:
locator - the service locator
type - the type
name - the name
Returns:
a descriptor that matches the given type and name

getAllDescriptorsByContract

public static List<? extends Descriptor> getAllDescriptorsByContract(ServiceLocator locator,
                                                                     Class type)
Deprecated. 
Get all of the descriptors for the given contract type.

Parameters:
locator - the service locator
type - the contract type
Returns:
a list of descriptors for the given contract type

getService

public <T> T getService(ServiceLocator locator,
                        Descriptor descriptor)
Deprecated. 
Get the service from the given service locator for the given descriptor.

Type Parameters:
T - the type of the service
Parameters:
locator - the service locator
descriptor - the descriptor
Returns:
the service; null if no binding matching the given descriptor can be found through the given service locator


Copyright © 2013 Oracle Corporation. All Rights Reserved.