org.jvnet.hk2.deprecated.internal
Class ContractLocatorImpl<T>

java.lang.Object
  extended by org.jvnet.hk2.deprecated.internal.ContractLocatorImpl<T>
Type Parameters:
T - The type of object to be returned from the Provider
All Implemented Interfaces:
ContractLocator<T>, Providers<T>, ServiceLocator<T>

Deprecated.

@Deprecated
public class ContractLocatorImpl<T>
extends Object
implements ContractLocator<T>

Author:
jwells

Constructor Summary
ContractLocatorImpl(ServiceLocator locator, String contractName)
          Deprecated. Creates a contract locator from the information given
 
Method Summary
 Collection<Provider<T>> all()
          Deprecated. Return all applicable Providers.
 ContractLocator<T> annotatedWith(Class<? extends Annotation> annotation)
          Deprecated. Qualify this ContractLocator to identify services have the given annotation.
 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.
 ContractLocator<T> in(Scope scope)
          Deprecated. Qualify this ContractLocator to identify services that are scoped scope.
 ContractLocator<T> named(String name)
          Deprecated. Qualify this ContractLocator to identify services that are named name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContractLocatorImpl

public ContractLocatorImpl(ServiceLocator locator,
                           String contractName)
Deprecated. 
Creates a contract locator from the information given

Parameters:
locator - The locator to use to fetch the implementations or providers
contractName - The name of the contract to search for
Method Detail

all

public Collection<Provider<T>> all()
Deprecated. 
Description copied from interface: Providers
Return all applicable Providers. Will always be a non-null return value.

Specified by:
all in interface Providers<T>

getProvider

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

Currently "best" is reserved for future use.

Specified by:
getProvider in interface Providers<T>

get

public T get()
Deprecated. 
Description copied from interface: Providers
A shortcut for
  if (getProvider() != null)
    return getProvider().get();
  return null;
 

Specified by:
get in interface Providers<T>

getByType

public <U> U getByType(Class<U> type)
Deprecated. 
Description copied from interface: Providers
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.

Specified by:
getByType in interface Providers<T>
Parameters:
type - the required type of the returned object
Returns:
the component or a suitable proxy of the given type

named

public ContractLocator<T> named(String name)
Deprecated. 
Description copied from interface: ContractLocator
Qualify this ContractLocator to identify services that are named name.

Specified by:
named in interface ContractLocator<T>
Parameters:
name - the name of the service
Returns:
the same ContractLocator instance, now additionally qualified by name

in

public ContractLocator<T> in(Scope scope)
Deprecated. 
Description copied from interface: ContractLocator
Qualify this ContractLocator to identify services that are scoped scope.

Specified by:
in in interface ContractLocator<T>
Parameters:
scope - the scope of the service
Returns:
the same ContractLocator instance, now additionally qualified by scope

annotatedWith

public ContractLocator<T> annotatedWith(Class<? extends Annotation> annotation)
Deprecated. 
Description copied from interface: ContractLocator
Qualify this ContractLocator to identify services have the given annotation. This method may be chained to specify multiple annotations.

Specified by:
annotatedWith in interface ContractLocator<T>
Parameters:
annotation - the annotation that the service must have
Returns:
the same ContractLocator instance, now additionally qualified by the newly specified annotation.


Copyright © 2013 Oracle Corporation. All Rights Reserved.