|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openxava.util.Maps
public class Maps
Utilities to work with maps.
| Constructor Summary | |
|---|---|
Maps()
|
|
| Method Summary | |
|---|---|
static java.util.Map |
clone(java.util.Map m)
Create a clone. |
static java.lang.Object |
getValueFromQualifiedName(java.util.Map tree,
java.lang.String qualifiedName)
Obtain a value in a map with nested maps from a qualified name. |
static boolean |
isEmpty(java.util.Map values)
It's empty if is null, without elements, with null elements or elements with neutral value (empty strings, collections, nulls). |
static boolean |
isEmptyOrZero(java.util.Map values)
It's empty if is null, without elements, with null elements or elements with neutral value (empty strings, collections, nulls or zeroes). |
static java.util.Map |
plainToTree(java.util.Map plainMap)
Converts a plain map (without levels) in a tree map. |
static void |
putValueFromQualifiedName(java.util.Map tree,
java.lang.String qualifiedName,
java.lang.Object value)
Put a value in a map with nested maps from a qualified name. |
static java.util.Map |
recursiveClone(java.util.Map origin)
Does a recursive clone of map. |
static java.util.Map |
treeToPlain(java.util.Map treeMap)
Converts a tree map in a plain map (without levels). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Maps()
| Method Detail |
|---|
public static java.util.Map clone(java.util.Map m)
Tries to make a clone using the
clone() method of
the origin if this is Cloneable, otherwise do a manual clon
of the map, without clone the elements (it's to say, it does not
make a deep clone).
m - Original map to clone. Has to be Cloneable or has a
default contructor and implementing putAll method.
java.lang.IllegalArgumentException - If precondition is broken
public static java.lang.Object getValueFromQualifiedName(java.util.Map tree,
java.lang.String qualifiedName)
(((Map) mymap.get("a")).get("b")).get("c")
is equal to:
Maps.getValueFromQualifiedName(mymap, "a.b.c")
tree - Map with map in some values, hence in tree-form.qualifiedName - Name in form a.b.c.
public static void putValueFromQualifiedName(java.util.Map tree,
java.lang.String qualifiedName,
java.lang.Object value)
(((Map) mymap.get("a")).get("b")).put("c", value)
is equal to:
Maps.putValueFromQualifiedName(mymap, "a.b.c", value)
tree - Map with map in some values, hence in tree-form.qualifiedName - Name in form a.b.c.value - Value to putpublic static java.util.Map recursiveClone(java.util.Map origin)
A recursive clone means that if some value is a map itself this method is applied to it.
origin - Cannot be null. Must to have a default constructor
public static boolean isEmpty(java.util.Map values)
Numeric values with value 0 not are considered empty.
values - Can be null.public static boolean isEmptyOrZero(java.util.Map values)
Numeric values with value 0 are considered empty.
values - Can be null.public static java.util.Map plainToTree(java.util.Map plainMap)
That is, convert:
{invoice.year=2006, invoice.number=1, number=3}
in
{invoice={year=2006, number=1}, number=3}
plainMap - This argument is not changed. The keys must be strings. Mustn't be null
public static java.util.Map treeToPlain(java.util.Map treeMap)
That is, convert:
{invoice={year=2006, number=1}, number=3}
in
{invoice.year=2006, invoice.number=1, number=3}
treeMap - This argument is not changed. The keys must be strings. Mustn't be null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||