org.glassfish.hk2
Interface Providers<T>

All Known Subinterfaces:
ContractLocator<T>, ServiceLocator<T>
All Known Implementing Classes:
ContractLocatorImpl, ContractLocatorImpl

Deprecated.

@Deprecated
public interface Providers<T>

This contract provides a means to access runtime component providers.

This is often times produced by ContractLocator and ServiceLocator.

Author:
Jerome Dochez, Jeff Trent, Mason Taube

Method Summary
 Collection<Provider<T>> all()
          Deprecated. Return all applicable Providers.
 T get()
          Deprecated. A shortcut for
<U> U
getByType(Class<U> type)
          Deprecated. Obtain a reference to the component/service from the associated provider.
 Provider<T> getProvider()
          Deprecated. Return the "best" Provider from the collection that matches current criteria.
 

Method Detail

all

Collection<Provider<T>> all()
Deprecated. 
Return all applicable Providers. Will always be a non-null return value.


getProvider

Provider<T> getProvider()
Deprecated. 
Return the "best" Provider from the collection that matches current criteria. If the collection all() is not empty, this will return a non null value. Otherwise the return value is null.

Currently "best" is reserved for future use.


get

T get()
Deprecated. 
A shortcut for
  if (getProvider() != null)
    return getProvider().get();
  return null;
 


getByType

<U> U getByType(Class<U> type)
Deprecated. 
Obtain a reference to the component/service from the associated provider. The given type may be used by the provider to obtain and return a proxy rather than the actual component.

Parameters:
type - the required type of the returned object
Returns:
the component or a suitable proxy of the given type
Throws:
ClassCastException - if the component is not an instance of the given type
ComponentException - if the associated provider failed to get or create an instance of the component


Copyright © 2013 Oracle Corporation. All Rights Reserved.