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 OptionsMapcreate()This is based onOptionsMapWrapper.static OptionsMapThis is based onOptionsMapWrapper.static OptionsMapfrom(Properties base) This is based onOptionsMapWrapperdefault BooleangetBoolean(String key) default BooleangetBoolean(String key, Boolean defaultValue) default Doubledefault Doubledefault Integerdefault Integerdefault Longdefault Longdefault <V> Vnull as default value and no conversiondefault <V> VDefault is nulldefault <V> VNo conversion, returned value type depends on what it was storeddefault <V> VConvert a string value returned by the key using the converter parameter.default Stringdefault StringExpects the key to return a string and returns it as-is.static OptionsMapunmodifiableOptionsMap(Map<String, Object> base) This is simply the chaining offrom(Map)andCollections.unmodifiableMap(Map), ie, returns a read-only options map.static OptionsMapMethods 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 raisingClassCastExceptionThe 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
-