Qwylt

java.lang.module
Class ServiceSpace.Locator

java.lang.Object
  extended by java.lang.module.ServiceSpace.Locator
Direct Known Subclasses:
ServiceLocator
Enclosing class:
ServiceSpace

public abstract static class ServiceSpace.Locator
extends java.lang.Object

A locator for service instances.


Constructor Summary
ServiceSpace.Locator()
           
 
Method Summary
protected
<T> java.util.List<T>
getCachedServices(ServiceType<T> type, ServiceSpace space)
          Returns service instances of the specified type that were previously added to the service space.
abstract
<T> T
getService(ServiceType<T> type, ServiceSpace space)
          Returns or creates a service instance of the specified type.
abstract
<T> boolean
getServices(ServiceType<T> type, ServiceSpace space, java.util.List<T> result)
          Returns or creates all service instances of the specified type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceSpace.Locator

public ServiceSpace.Locator()
Method Detail

getService

public abstract <T> T getService(ServiceType<T> type,
                                 ServiceSpace space)
Returns or creates a service instance of the specified type.

Parameters:
type - The service type.
space - The service space that is requesting the instance.
Returns:
The service or null if not found or could not be created.

getServices

public abstract <T> boolean getServices(ServiceType<T> type,
                                        ServiceSpace space,
                                        java.util.List<T> result)
Returns or creates all service instances of the specified type.

Parameters:
type - The service type.
Returns:
The services, empty if none.

getCachedServices

protected <T> java.util.List<T> getCachedServices(ServiceType<T> type,
                                                  ServiceSpace space)
Returns service instances of the specified type that were previously added to the service space.

Parameters:
type - The service type.
space - The service space that may hold the cached instances.
Returns:
The cached services. May be empty or null.

Qwylt

Send comments or questions to Bryan Atsatt