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(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
          Qualify this ContractLocator to identify services have the given annotations.
 ContractLocator<T> in(Scope scope)
          Qualify this ContractLocator to identify services that are scoped scope.
 ContractLocator<T> named(java.lang.String name)
          Qualify this ContractLocator to identify services that are named name.
 
Methods inherited from interface org.glassfish.hk2.Providers
all, get, getProvider
 

Method Detail

named

ContractLocator<T> named(java.lang.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(java.lang.Class<? extends java.lang.annotation.Annotation>... annotations)
Qualify this ContractLocator to identify services have the given annotations.

Parameters:
annotations - the annotations that the service must have
Returns:
the same ContractLocator instance, now additionally qualified by annotations


Copyright © 2011 Oracle Corporation. All Rights Reserved.