com.ebmwebsourcing.easycommons.registry
Class ResourceRegistry<T>
java.lang.Object
com.ebmwebsourcing.easycommons.registry.ResourceRegistry<T>
public class ResourceRegistry<T>
- extends Object
This is a generic implementation of a resource registry. All methods that
alter registry state are thread safe.
- Author:
- ofabre
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResourceRegistry
public ResourceRegistry()
register
public void register(String key,
T resource)
- Parameters:
key - cannot be nullresource - cannot be null
- Throws:
KeyAlreadyBoundException - if the provided key is already bound to a registered object
unregister
public void unregister(String key)
- Parameters:
key - cannot be null
- Throws:
KeyNotFoundException - if the provided key isn't found in registry
lookup
public T lookup(String key)
- Parameters:
key - cannot be null
- Returns:
- the resource bound to this key or null if not found
Copyright © 2012 Petals Link. All Rights Reserved.