org.glassfish.hk2
Interface ContractLocator<T>

All Superinterfaces:
Providers<T>, ServiceLocator<T>

public interface ContractLocator<T>
extends ServiceLocator<T>

Provides a means to locate services in the HK2 services registry by contract.

ContractLocators are typically produced by calling one of the Locator forContract() methods.

This interface provides a builder like pattern that can be used to refine the criteria for the Providers it will return.

Author:
Jerome Dochez, Jeff Trent, Mason Taube
See Also:
Locator, Providers

Method Summary
 ContractLocator<T> annotatedWith(Class<? extends Annotation> annotation)
          Qualify this ContractLocator to identify services have the given annotation.
 ContractLocator<T> in(Scope scope)
          Qualify this ContractLocator to identify services that are scoped scope.
 ContractLocator<T> named(String name)
          Qualify this ContractLocator to identify services that are named name.
 
Methods inherited from interface org.glassfish.hk2.Providers
all, get, getByType, getProvider
 

Method Detail

named

ContractLocator<T> named(String name)
Qualify this ContractLocator to identify services that are named name.

Parameters:
name - the name of the service
Returns:
the same ContractLocator instance, now additionally qualified by name

in

ContractLocator<T> in(Scope scope)
Qualify this ContractLocator to identify services that are scoped scope.

Parameters:
scope - the scope of the service
Returns:
the same ContractLocator instance, now additionally qualified by scope

annotatedWith

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

Parameters:
annotation - the annotation that the service must have
Returns:
the same ContractLocator instance, now additionally qualified by the newly specified annotation.


Copyright © 2012 Oracle Corporation. All Rights Reserved.