org.placidus.util
Class MapHelper

java.lang.Object
  extended by org.placidus.util.MapHelper

public class MapHelper
extends java.lang.Object

Helper functions for Map

Author:
ds

Constructor Summary
MapHelper()
           
 
Method Summary
static java.util.Map cloneMap(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map)
          This method tries to clone given map with different methods: 1) checks if Cloneable interface is implemented, then clone will be called with reflection. 2) if Cloneable interface is not implemented, a new HashMap will be instantiated and filled by calling putAll with given map entries.
static java.util.Map cloneMapNew(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map)
          This method tries to clone given map by instantiating a new HashMap and filling by call of putAll with given map entries.
static java.util.Map<? extends java.lang.Object,? extends java.lang.Object> getMapWithValues(java.lang.Object... obj)
          Creates a new HashMap and fills it with given argruments.
static boolean isMapModifiable(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map)
          To check if given map is modifiable or not.
static void putAll(java.lang.String keyPrefix, java.util.Map<java.lang.String,? extends java.lang.Object> src, java.util.Map<java.lang.String,java.lang.Object> dest)
          To put all entries with keyPrefix at the begin of each keyname to destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapHelper

public MapHelper()
Method Detail

isMapModifiable

public static boolean isMapModifiable(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map)
To check if given map is modifiable or not.

Parameters:
map - to check
Returns:
true if map is modifiable, false otherwise

cloneMap

public static java.util.Map cloneMap(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map)
This method tries to clone given map with different methods: 1) checks if Cloneable interface is implemented, then clone will be called with reflection. 2) if Cloneable interface is not implemented, a new HashMap will be instantiated and filled by calling putAll with given map entries.

Parameters:
map - to clone
Returns:
cloned map

cloneMapNew

public static java.util.Map cloneMapNew(java.util.Map<? extends java.lang.Object,? extends java.lang.Object> map)
This method tries to clone given map by instantiating a new HashMap and filling by call of putAll with given map entries.

Parameters:
map - to clone
Returns:
new HashMap filled by putAll with values from given map

putAll

public static void putAll(java.lang.String keyPrefix,
                          java.util.Map<java.lang.String,? extends java.lang.Object> src,
                          java.util.Map<java.lang.String,java.lang.Object> dest)
To put all entries with keyPrefix at the begin of each keyname to destination.

Parameters:
keyPrefix - prefix for key at destination
src - to read from
dest - to put into

getMapWithValues

public static java.util.Map<? extends java.lang.Object,? extends java.lang.Object> getMapWithValues(java.lang.Object... obj)
Creates a new HashMap and fills it with given argruments.

Parameters:
obj - key or value, depends on even or odd attribute


Copyright © 2006 DS. All Rights Reserved.