Package uk.ac.ebi.utils.collections
Interface OptionsMap
- All Known Implementing Classes:
OptionsMapWrapper
A variant of the map interface that has the purpose of easing the manipulation of
options based on string values. These are typically fetched from
Properties
and the like.
See unit tests for details.- Author:
- brandizi
- Date:
- 16 Sep 2020
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic OptionsMap
create()
This is based onOptionsMapWrapper
.static OptionsMap
This is based onOptionsMapWrapper
.static OptionsMap
from
(Properties base) This is based onOptionsMapWrapper
default Boolean
getBoolean
(String key) default Boolean
getBoolean
(String key, Boolean defaultValue) default Double
default Double
default Integer
default Integer
default Long
default Long
default <V> V
null as default value and no conversiondefault <V> V
Default is nulldefault <V> V
No conversion, returned value type depends on what it was storeddefault <V> V
Convert a string value returned by the key using the converter parameter.default String
default String
Expects the key to return a string and returns it as-is.static OptionsMap
unmodifiableOptionsMap
(Map<String, Object> base) This is simply the chaining offrom(Map)
andCollections.unmodifiableMap(Map)
, ie, returns a read-only options map.static OptionsMap
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
getOpt
Convert a string value returned by the key using the converter parameter. If the key is null, returns the default If it's a string, returns the result of the conversion Else, casts it to V, possibly raisingClassCastException
The idea is that we're dealing with a mix of object values or string values that might represent some other types. This is a base for other specific methods (eg,getDouble(String, Double)
. * -
getOpt
Default is null -
getOpt
No conversion, returned value type depends on what it was stored -
getOpt
null as default value and no conversion -
getDouble
-
getDouble
-
getInt
-
getInt
-
getLong
-
getLong
-
getString
Expects the key to return a string and returns it as-is. In other words, this is just to make the type casting easier. -
getString
-
getBoolean
-
getBoolean
-
from
This is based onOptionsMapWrapper
. -
from
This is based onOptionsMapWrapper
-
create
This is based onOptionsMapWrapper
. -
unmodifiableOptionsMap
This is simply the chaining offrom(Map)
andCollections.unmodifiableMap(Map)
, ie, returns a read-only options map. -
unmodifiableOptionsMap
-