Interface StructuredMap
- All Known Implementing Classes:
StructuredDictionary
,StructuredParameters
StructuredParameters
and StructuredDictionary
.
Contains methods for converting structured dictionaries to Java Map
containing Java plain objects.-
Method Summary
Modifier and TypeMethodDescriptiondefault Map<String,
BigDecimal> Returns this map with Structured Item values converted toBigDecimal
objects.boolMap()
Returns this map with Structured Item values converted toBoolean
objects.bytesMap()
Returns this map with Structured Item values converted to byte[] objects.Returns this map with Structured Item values converted toDouble
objects.default <T extends StructuredItem>
Set<Map.Entry<String,T>> entrySet()
Returns entry set of underlying mapdefault <T extends StructuredItem>
Set<Map.Entry<String,T>> Returns entry set of underlying mapdefault Optional<BigDecimal>
getBigDecimal
(String key) ReturnsBigDecimal
value of the Item stored at requested key.ReturnsBoolean
value of the Item stored at requested key.default Optional<byte[]>
Returns byte[] value of the Item stored at requested key.ReturnsDouble
value of the Item stored at requested key.ReturnsInteger
value of the Item stored at requested key.default <T extends StructuredItem>
Optional<T>ReturnsStructuredItem
stored at requested key.default <T extends StructuredItem>
Optional<T>ReturnsStructuredItem
stored at requested key.ReturnsLong
value of the Item stored at requested key.Returns value of Item stored at requested key, converted to aString
.intMap()
Returns this map with Structured Item values converted toInteger
objects.default boolean
isEmpty()
Returns true if underlying map contains no elements<T extends StructuredItem>
Map<String,T> itemMap()
ReturnsMap
of Structured Items stored in this Dictionary or Parameters.default <T extends StructuredItem>
Map<String,T> ReturnsMap
of Structured Items stored in this Dictionary or Parameters.keySet()
Returns the key set of underlying maplongMap()
Returns this map with Structured Item values converted toLong
objects.Returns this map with Structured Item values converted toString
objects.default <T extends StructuredItem>
List<T>values()
Returns values of underlying mapdefault <T extends StructuredItem>
List<T>Returns values of underlying map
-
Method Details
-
itemMap
ReturnsMap
of Structured Items stored in this Dictionary or Parameters. Keys or returned map correspond to Dictionary or Parameters keys. Values areStructuredItem
members of Dictionary or Parameters.- Type Parameters:
T
- Specific Item class if needed. No type check is performed, only simple casting.- Returns:
- Underlying map of
StructuredItem
objects
-
itemMap
ReturnsMap
of Structured Items stored in this Dictionary or Parameters.Similar to
itemMap()
()}, but class of map values is provided as method argument rather than "generic type argument", e.g.myDict.itemMap(StructuredInteger.class)
instead ofmyDict.<StructuredInteger>itemMap()
.- Type Parameters:
T
- Type of map values- Parameters:
itemClass
- Class of map values. No type check is performed, only simple casting.- Returns:
- Underlying map of
StructuredItem
objects
-
keySet
Returns the key set of underlying map- Returns:
- Map's key set
- See Also:
-
entrySet
Returns entry set of underlying map- Type Parameters:
T
- Specific Item class if needed. No type check is performed, only simple casting.- Returns:
- Map's entry set
- See Also:
-
entrySet
Returns entry set of underlying map- Type Parameters:
T
- Type of map values- Parameters:
itemClass
- Class of map values. No type check is performed, only simple casting.- Returns:
- Map's entry set
- See Also:
-
values
Returns values of underlying mapContrary to
Map.values()
, aList
is returned rather thanCollection
. It's because order of Structured Parameters and Dictionary members is defined.- Type Parameters:
T
- Specific Item class if needed. No type check is performed, only simple casting.- Returns:
- Map's values
- See Also:
-
values
Returns values of underlying mapContrary to
Map.values()
, aList
is returned rather thanCollection
. It's because order of Structured Parameters and Dictionary members is defined.- Type Parameters:
T
- Type of map values- Parameters:
itemClass
- Class of map values. No type check is performed, only simple casting.- Returns:
- Map's values
- See Also:
-
isEmpty
default boolean isEmpty()Returns true if underlying map contains no elements- Returns:
- True if map contains no elements
-
stringMap
Returns this map with Structured Item values converted toString
objects.- Returns:
- Map with values converted to String
- See Also:
-
boolMap
Returns this map with Structured Item values converted toBoolean
objects. This map must containStructuredBoolean
values only.- Returns:
- Map with values converted to Boolean
- Throws:
UnsupportedOperationException
- Thrown if this map contains non-StructuredBoolean
values
-
intMap
Returns this map with Structured Item values converted toInteger
objects. This map must containStructuredInteger
values only.(int) cast is used internally, which means that returned value will be wrong for item values smaller than
Integer.MIN_VALUE
or grater thanInteger.MAX_VALUE
.- Returns:
- Map with values converted to Integer
- Throws:
UnsupportedOperationException
- Thrown if this map contains non-StructuredInteger
values
-
longMap
Returns this map with Structured Item values converted toLong
objects. This map must containStructuredInteger
values only.- Returns:
- Map with values converted to Long
- Throws:
UnsupportedOperationException
- Thrown if this map contains non-StructuredInteger
values
-
bigDecimalMap
Returns this map with Structured Item values converted toBigDecimal
objects. This map must containStructuredDecimal
orStructuredInteger
values only.- Returns:
- Map with values converted to BigDecimal
- Throws:
UnsupportedOperationException
- Thrown if this map contains a value which is neitherStructuredDecimal
norStructuredInteger
-
doubleMap
Returns this map with Structured Item values converted toDouble
objects. This map must containStructuredDecimal
orStructuredInteger
values only.- Returns:
- Map with values converted to Double
- Throws:
UnsupportedOperationException
- Thrown if this map contains a value which is neitherStructuredDecimal
norStructuredInteger
-
bytesMap
Returns this map with Structured Item values converted to byte[] objects. This map must containStructuredBytes
values only.- Returns:
- Map with values converted to byte[]
- Throws:
UnsupportedOperationException
- Thrown if this map contains non-StructuredBytes
values
-
getItem
ReturnsStructuredItem
stored at requested key. No type check is performed.- Type Parameters:
T
- Specific Item class if needed. No type check is performed, only simple casting.- Parameters:
key
- Dictionary or Parameter key- Returns:
- Structured Item at requested key, or empty Optional if there is no value at requested key
-
getItem
ReturnsStructuredItem
stored at requested key. Throws an exception in case of a type mismatch.- Type Parameters:
T
- Type of map value- Parameters:
key
- Dictionary or Parameter keyitemClass
- Class of map value- Returns:
- Structured Item at requested key, or empty Optional if there is no value at requested key
- Throws:
UnsupportedOperationException
- When requested value is not an instance of requested itemClass
-
getString
Returns value of Item stored at requested key, converted to aString
. Valid for all Item types: their String representation is returned.Mostly, it should be used for String and Token Items.
- Parameters:
key
- Dictionary or Parameter key- Returns:
- String value of the Item at requested key, or empty Optional if there is no value at requested key
-
getBool
ReturnsBoolean
value of the Item stored at requested key. Valid forStructuredBoolean
Items only.- Parameters:
key
- Dictionary or Parameter key- Returns:
- Boolean value of the Item at requested key, or empty Optional if there is no value at requested key
- Throws:
UnsupportedOperationException
- When Item at requested key is not aStructuredBoolean
-
getInt
ReturnsInteger
value of the Item stored at requested key. Valid forStructuredInteger
Items only.(int) cast is used internally, which means that returned value will be wrong for item values smaller than
Integer.MIN_VALUE
or grater thanInteger.MAX_VALUE
.- Parameters:
key
- Dictionary or Parameter key- Returns:
- Integer value of the Item at requested key, or empty Optional if there is no value at requested key
- Throws:
UnsupportedOperationException
- When Item at requested key is not aStructuredInteger
-
getLong
ReturnsLong
value of the Item stored at requested key. Valid forStructuredInteger
Items only.- Parameters:
key
- Dictionary or Parameter key- Returns:
- Long value of the Item at requested key, or empty Optional if there is no value at requested key
- Throws:
UnsupportedOperationException
- When Item at requested key is not aStructuredInteger
-
getBigDecimal
ReturnsBigDecimal
value of the Item stored at requested key. Valid forStructuredDecimal
andStructuredInteger
Items only.- Parameters:
key
- Dictionary or Parameter key- Returns:
- BigDecimal value of the Item at requested key, or empty Optional if there is no value at requested key
- Throws:
UnsupportedOperationException
- When Item at requested key is neitherStructuredDecimal
norStructuredInteger
-
getDouble
ReturnsDouble
value of the Item stored at requested key. Valid forStructuredDecimal
andStructuredInteger
Items only.- Parameters:
key
- Dictionary or Parameter key- Returns:
- Double value of the Item at requested key, or empty Optional if there is no value at requested key
- Throws:
UnsupportedOperationException
- When Item at requested key is neitherStructuredDecimal
norStructuredInteger
-
getBytes
Returns byte[] value of the Item stored at requested key. Valid forStructuredBytes
Items only.- Parameters:
key
- Dictionary or Parameter key- Returns:
- byte[] value of the Item at requested key, or empty Optional if there is no value at requested key
- Throws:
UnsupportedOperationException
- When Item at requested key is not aStructuredBytes
-