org.jplate.foundation.util.impl
Class SynchronizedHashMapFactory<K,V>

java.lang.Object
  extended by org.jplate.foundation.util.impl.SynchronizedHashMapFactory<K,V>
Type Parameters:
K - The key type stored in HashMap.
V - The value type stored in HashMap.
All Implemented Interfaces:
java.io.Serializable, FactoryIfc<java.util.Map<K,V>>, MapFactoryIfc<K,V>

public final class SynchronizedHashMapFactory<K,V>
extends java.lang.Object
implements MapFactoryIfc<K,V>

Factory that creates synchronized Map's backed by HashMap's.

To create a synchronized HashMap containing keys Foo and value Bar, perform the following:

final SynchronizedHashMapFactory <Foo, Bar> factory =
    new SynchronizedHashMapFactory <Foo, Bar> ();

final Map sMap <Foo, Bar> = factory.create ();
    
Modifications:
    $Date: 2008-12-02 12:32:45 -0500 (Tue, 02 Dec 2008) $
    $Revision: 479 $
    $Author: sfloess $
    $HeadURL: https://jplate.svn.sourceforge.net/svnroot/jplate/trunk/src/dev/java/org/jplate/foundation/util/impl/SynchronizedHashMapFactory.java $
    

See Also:
HashMap, Map, Serialized Form

Field Summary
private  org.apache.commons.logging.Log _log
          Used for logging.
private static long serialVersionUID
          For serialization purposes.
 
Constructor Summary
SynchronizedHashMapFactory()
          Default constructor.
 
Method Summary
 java.util.Map<K,V> create()
          Creates and returns a synchronized Map backed by a HashMap.
 void destroy(java.util.Map<K,V> map)
          Cleanup a previsously instantiated Map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
For serialization purposes.

See Also:
Constant Field Values

_log

private final transient org.apache.commons.logging.Log _log
Used for logging.

Constructor Detail

SynchronizedHashMapFactory

public SynchronizedHashMapFactory()
Default constructor.

Method Detail

create

public java.util.Map<K,V> create()
Creates and returns a synchronized Map backed by a HashMap.

Specified by:
create in interface FactoryIfc<java.util.Map<K,V>>
Returns:
A synchronized Map backed by a HashMap
See Also:
Collections.synchronizedMap(java.util.Map), HashMap, Map

destroy

public void destroy(java.util.Map<K,V> map)
Cleanup a previsously instantiated Map. Assuming map is not null, the clear method will be called.

Specified by:
destroy in interface FactoryIfc<java.util.Map<K,V>>
Parameters:
map - The object to clean up.