ValueMap is an easy way to access properties of a resource. With resources you can use {@link Resource#getValueMap()} to obtain thevalue map of a resource. The various getter methods can be used to get the properties of the resource. In addition a value map returned by a resource supports getting of deep values, like get("content/title") which is equivalent to call getChild("content") on the resource, get the value map of that resource and call get("title") - but without requiring to do all the checks. Only the following methods support deep reads: {@link #get(Object)}, {@link #get(String,Class)}, {@link #get(String,Object)} and{@link #containsKey(Object)}. A ValueMap should be immutable.
IValueMap implementation that holds values, parses Strings, and exposes a variety of convenience methods. In addition to a no-arg constructor and a copy constructor that takes a Map argument, ValueMaps can be constructed using a parsing constructor. ValueMap(String) will parse values from the string in comma separated key/value assignment pairs. For example, new ValueMap("a=9,b=foo").
Values can be retrieved from the ValueMap in the usual way or with methods that do handy conversions to various types, including String, StringValue, int, long, double, Time and Duration.
The makeImmutable method will make the underlying Map immutable. Further attempts to change the Map will result in a RuntimeException.
The toString method converts a ValueMap object to a readable key/value string for diagnostics.
@author Jonathan Locke
@author Doug Donohoe
@since 1.2.6
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |