org.qi4j.api.service
Interface ServiceFinder


public interface ServiceFinder

Interface used to query for ServiceReferences. Each ServiceFinder is obtained from a specific Module, and the lookup rules are the following: 1) First look in the same Module as the ServiceLocator 2) Then look in the same Layer as the ServiceLocator. Any Services declared with Visibility Layer and Application should be included 3) Then look in the extended Layers. Any Services declared with Visibility Application should be included


Method Summary
<T> ServiceReference<T>
findService(Type serviceType)
          Find a ServiceReference that implements the given type.
<T> Iterable<ServiceReference<T>>
findServices(Type serviceType)
          Find ServiceReferences that implements the given type.
 

Method Detail

findService

<T> ServiceReference<T> findService(Type serviceType)
Find a ServiceReference that implements the given type.

Parameters:
serviceType - the type that the Service must implement
Returns:
a ServiceReference if one is found, or null if none exists

findServices

<T> Iterable<ServiceReference<T>> findServices(Type serviceType)
Find ServiceReferences that implements the given type.

The order of the references is such that Services more local to the querying Module is earlier in the list.

Parameters:
serviceType - the type that the Services must implement
Returns:
an iterable of ServiceReferences for the given type. It is empty if none exist