com.ebmwebsourcing.easycommons.registry
Class ResourceRegistry<T>
java.lang.Object
com.ebmwebsourcing.easycommons.registry.ResourceRegistry<T>
public class ResourceRegistry<T>
- extends java.lang.Object
This is a generic implementation of a resource registry. All methods that
alter registry state are thread safe.
- Author:
- ofabre
|
Method Summary |
T |
lookup(java.lang.String key)
|
void |
register(java.lang.String key,
T resource)
|
void |
unregister(java.lang.String key)
|
| 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(java.lang.String key,
T resource)
- Parameters:
key - must not be nullresource - must not be null
- Throws:
KeyAlreadyBoundException - if the provided key is already bound to a registered object
unregister
public void unregister(java.lang.String key)
- Parameters:
key - must not be null
- Throws:
KeyNotFoundException - if the provided key isn't found in registry
lookup
public T lookup(java.lang.String key)
- Parameters:
key - must not be null
- Returns:
- the resource bound to this key or null if not found
Copyright © 2012 Petals Link. All Rights Reserved.