net.dpml.lang
Class StandardServiceRegistry

java.lang.Object
  extended by net.dpml.lang.StandardServiceRegistry
All Implemented Interfaces:
ServiceRegistry

public class StandardServiceRegistry
extends Object
implements ServiceRegistry

Default service registry implementation that resolves services via services resolvable using java.util.ServiceLoader.

Version:
2.1.0
Author:
Digital Product Management Library

Constructor Summary
StandardServiceRegistry()
          Creation of a new service registry with no parent.
StandardServiceRegistry(ServiceRegistry parent)
          Creation of a new service registry with fallback delegation to a parent registry.
 
Method Summary
<T> T
lookup(Class<T> type)
          Matches a service in the registry with the supplied type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardServiceRegistry

public StandardServiceRegistry()
Creation of a new service registry with no parent.


StandardServiceRegistry

public StandardServiceRegistry(ServiceRegistry parent)
Creation of a new service registry with fallback delegation to a parent registry.

Parameters:
parent - an optional parent registry
Method Detail

lookup

public <T> T lookup(Class<T> type)
Matches a service in the registry with the supplied type. If no match is found and a parent registry has been delclared, the lookup request is passed onto the parent registry, otherwise null is returned.

Specified by:
lookup in interface ServiceRegistry
Parameters:
type - the service type to locate
Returns:
an instance of the type or null if unresolvable