|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.plumtree.remote.util.NamedValueMap
Utility class that converts between an array of NamedValues and a
HashMap. Useful when manipulating arrays of NamedValues.
| Constructor Summary | |
NamedValueMap()
Default constructor |
|
NamedValueMap(NamedValue[] nvArray)
Creates a new NamedValueMap instance and initializes it
with values from the given array. |
|
| Method Summary | |
void |
fromArray(NamedValue[] nvArray)
Clears the current values and initializes with values from the given array. |
java.lang.String |
get(java.lang.String key)
Returns the string value to which the specified name key is mapped or null
if the key is not mapped to any values. |
java.lang.String |
put(java.lang.String key,
java.lang.String value)
Adds a name/value pair to the map, replacing any existing value. |
java.lang.String |
put(java.lang.String key,
java.lang.String[] values)
Adds multiple name/value pairs to the map, where the value is a String[], replacing any existing values. |
void |
remove(java.lang.String key)
Removes the mapping for the key from the map if present. |
void |
remove(java.lang.String key,
java.lang.String value)
Removes the mapping for the key and value from the map if present. |
NamedValue[] |
toArray()
Converts the contents of the NamedValueMap into a NamedValue
array, and returns the array. |
java.lang.String |
toString()
Returns a string for debugging. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public NamedValueMap()
public NamedValueMap(NamedValue[] nvArray)
NamedValueMap instance and initializes it
with values from the given array. Null NamedValues and NamedValues with
null keys will not be added to the map. NamedValues with null values but
valid keys will be imported
nvArray - the NamedValue array| Method Detail |
public java.lang.String get(java.lang.String key)
null
if the key is not mapped to any values. If the NamedValueMap has already been stored in the portal, then all names will be uppercased.
If the key is mapped to a String[], then the first element of the String[] will be returned.
key - the key for which a string will be returned
null if there is no mapping
public java.lang.String put(java.lang.String key,
java.lang.String value)
key - the key name; all names will be uppercased by the portalvalue - the value to assign to the key; can be null
null if there was no mapping for key. A null return can also indicate that the NamedValueMap previously associated null with the specified key. If the previous element was a String[], this method returns the first element of the String[].
public java.lang.String put(java.lang.String key,
java.lang.String[] values)
put("key1", {"value1", "value2", "value3"});
the following would be returned to the portal as the named value pairs: UserPropertyInfo in Profile.
key - the key name; all names will be uppercased by the portalvalues - the value to assign to the key; can be null
null if there was no mapping for key. A null return can also indicate that the NamedValueMap previously associated null with the specified key. If the previous element was a String[], this will return the first element of the String[].public void fromArray(NamedValue[] nvArray)
NamedValues and NamedValues with null names will not be added.
NamedValues with null keys will be added.
If multiple NamedValues have the same key and different values, then the values will be added to the map as a String[].
nvArray - the NamedValue arraypublic NamedValue[] toArray()
NamedValueMap into a NamedValue
array, and returns the array.
Keys with String[] mappings will be returned as multiple NamedValues.
NamedValue arraypublic void remove(java.lang.String key)
key - the key to match
public void remove(java.lang.String key,
java.lang.String value)
key - the key to matchpublic java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright ©2008 Oracle® Corporation. All Rights Reserved.