ccc.commons
Class MapRegistry

java.lang.Object
  extended by ccc.commons.MapRegistry
All Implemented Interfaces:
Registry

public final class MapRegistry
extends java.lang.Object
implements Registry

A registry implementation using an in-memory map.

Author:
Civic Computing Ltd

Constructor Summary
MapRegistry()
          Constructor.
MapRegistry(java.lang.String location, java.lang.Object object)
          Constructor.
 
Method Summary
<T> T
get(java.lang.String location)
          Get an object from the registry.
 Registry put(java.lang.String location, java.lang.Object object)
          Put an object into JNDI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapRegistry

public MapRegistry(java.lang.String location,
                   java.lang.Object object)
Constructor. Create a map-based registry with a single item.

Parameters:
location - The location to store the item.
object - The item to store.

MapRegistry

public MapRegistry()
Constructor.

Method Detail

get

public <T> T get(java.lang.String location)
Get an object from the registry.

Specified by:
get in interface Registry
Type Parameters:
T - The type of the object at the specified location.
Parameters:
location - Location in the registry.
Returns:
The object at the specified location or NULL if the location is not found.

put

public Registry put(java.lang.String location,
                    java.lang.Object object)
Put an object into JNDI.

Specified by:
put in interface Registry
Parameters:
location - Location in the in the registry.
object - The object to put.
Returns:
'this' to allow a registry to be used in a 'fluently'.


Copyright © 2010. All Rights Reserved.