com.anasoft.os.daofusion.util
Class SimpleMapContainer<K,T>

java.lang.Object
  extended by com.anasoft.os.daofusion.util.SimpleMapContainer<K,T>
Type Parameters:
K - Type of the object key to be used within the object map.
T - Type of the object the container works with.
Direct Known Subclasses:
NestedPropertyCriteriaBasedConverter

public abstract class SimpleMapContainer<K,T>
extends java.lang.Object

Utility class intended to ease the implementation of simple map-based object containers.

Author:
vojtech.szocs

Constructor Summary
SimpleMapContainer()
           
 
Method Summary
 SimpleMapContainer<K,T> add(T object)
          Adds the given object to this container.
 void clear()
          Clears the list of objects.
 boolean containsKey(K key)
          Checks whether the object map contains the given key.
protected abstract  K getKey(T object)
          Returns the key for the given object.
 java.util.Map<K,T> getObjectMap()
          Returns the map of objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMapContainer

public SimpleMapContainer()
Method Detail

getKey

protected abstract K getKey(T object)
Returns the key for the given object.

Parameters:
object - Object for which the key is required.
Returns:
Object key to use within the object map.

add

public SimpleMapContainer<K,T> add(T object)
Adds the given object to this container.

Parameters:
object - Object to add.
Returns:
this for method chaining.

clear

public void clear()
Clears the list of objects.


getObjectMap

public java.util.Map<K,T> getObjectMap()
Returns the map of objects.

Note that the method returns an unmodifiable map to prevent further map manipulation.

Returns:
Object map.

containsKey

public boolean containsKey(K key)
Checks whether the object map contains the given key.

Parameters:
key - Object key.
Returns:
true if the object map contains the given key, false otherwise.


Copyright © 2008-2009 ANASOFT and contributors. All Rights Reserved.