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 toBigDecimalobjects.boolMap()Returns this map with Structured Item values converted toBooleanobjects.bytesMap()Returns this map with Structured Item values converted to byte[] objects.Returns this map with Structured Item values converted toDoubleobjects.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) ReturnsBigDecimalvalue of the Item stored at requested key.ReturnsBooleanvalue of the Item stored at requested key.default Optional<byte[]>Returns byte[] value of the Item stored at requested key.ReturnsDoublevalue of the Item stored at requested key.ReturnsIntegervalue of the Item stored at requested key.default <T extends StructuredItem>
Optional<T>ReturnsStructuredItemstored at requested key.default <T extends StructuredItem>
Optional<T>ReturnsStructuredItemstored at requested key.ReturnsLongvalue 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 toIntegerobjects.default booleanisEmpty()Returns true if underlying map contains no elements<T extends StructuredItem>
Map<String,T> itemMap()ReturnsMapof Structured Items stored in this Dictionary or Parameters.default <T extends StructuredItem>
Map<String,T> ReturnsMapof Structured Items stored in this Dictionary or Parameters.keySet()Returns the key set of underlying maplongMap()Returns this map with Structured Item values converted toLongobjects.Returns this map with Structured Item values converted toStringobjects.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
ReturnsMapof Structured Items stored in this Dictionary or Parameters. Keys or returned map correspond to Dictionary or Parameters keys. Values areStructuredItemmembers of Dictionary or Parameters.- Type Parameters:
T- Specific Item class if needed. No type check is performed, only simple casting.- Returns:
- Underlying map of
StructuredItemobjects
-
itemMap
ReturnsMapof 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
StructuredItemobjects
-
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(), aListis 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(), aListis 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 toStringobjects.- Returns:
- Map with values converted to String
- See Also:
-
boolMap
Returns this map with Structured Item values converted toBooleanobjects. This map must containStructuredBooleanvalues only.- Returns:
- Map with values converted to Boolean
- Throws:
UnsupportedOperationException- Thrown if this map contains non-StructuredBooleanvalues
-
intMap
Returns this map with Structured Item values converted toIntegerobjects. This map must containStructuredIntegervalues only.(int) cast is used internally, which means that returned value will be wrong for item values smaller than
Integer.MIN_VALUEor grater thanInteger.MAX_VALUE.- Returns:
- Map with values converted to Integer
- Throws:
UnsupportedOperationException- Thrown if this map contains non-StructuredIntegervalues
-
longMap
Returns this map with Structured Item values converted toLongobjects. This map must containStructuredIntegervalues only.- Returns:
- Map with values converted to Long
- Throws:
UnsupportedOperationException- Thrown if this map contains non-StructuredIntegervalues
-
bigDecimalMap
Returns this map with Structured Item values converted toBigDecimalobjects. This map must containStructuredDecimalorStructuredIntegervalues only.- Returns:
- Map with values converted to BigDecimal
- Throws:
UnsupportedOperationException- Thrown if this map contains a value which is neitherStructuredDecimalnorStructuredInteger
-
doubleMap
Returns this map with Structured Item values converted toDoubleobjects. This map must containStructuredDecimalorStructuredIntegervalues only.- Returns:
- Map with values converted to Double
- Throws:
UnsupportedOperationException- Thrown if this map contains a value which is neitherStructuredDecimalnorStructuredInteger
-
bytesMap
Returns this map with Structured Item values converted to byte[] objects. This map must containStructuredBytesvalues only.- Returns:
- Map with values converted to byte[]
- Throws:
UnsupportedOperationException- Thrown if this map contains non-StructuredBytesvalues
-
getItem
ReturnsStructuredItemstored 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
ReturnsStructuredItemstored 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
ReturnsBooleanvalue of the Item stored at requested key. Valid forStructuredBooleanItems 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
ReturnsIntegervalue of the Item stored at requested key. Valid forStructuredIntegerItems only.(int) cast is used internally, which means that returned value will be wrong for item values smaller than
Integer.MIN_VALUEor 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
ReturnsLongvalue of the Item stored at requested key. Valid forStructuredIntegerItems 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
ReturnsBigDecimalvalue of the Item stored at requested key. Valid forStructuredDecimalandStructuredIntegerItems 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 neitherStructuredDecimalnorStructuredInteger
-
getDouble
ReturnsDoublevalue of the Item stored at requested key. Valid forStructuredDecimalandStructuredIntegerItems 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 neitherStructuredDecimalnorStructuredInteger
-
getBytes
Returns byte[] value of the Item stored at requested key. Valid forStructuredBytesItems 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
-