Package liquibase.util
Class SmartMap
java.lang.Object
liquibase.util.SmartMap
Implementation of Map with the added methods
get(String, Class) and get(String, Object) to make the return values type safe and/or auto-converted.
Also adds set(String, Object) for easier builder-style code.
Returns keys in alphabetical order.-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()boolean<T> TReturn the value for the given key converted to the passed type.<T> TReturn the value for the given key converted to the type of the default value.inthashCode()booleanisEmpty()keySet()Like normalMap.put(Object, Object)operation, but if null is passed as "value" it removes the key/value from the map.voidWorks likeput(String, Object)but returns this SmartMap rather than the old value.intsize()values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
SmartMap
public SmartMap()
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKeyin interfaceMap<String,Object>
-
containsValue
- Specified by:
containsValuein interfaceMap<String,Object>
-
get
-
get
Return the value for the given key converted to the passed type. If the value associated with the key is null, null is returned. If the stored value is different than the passed type, a conversion is attempted usingObjectUtil.convert(Object, Class). Any conversion is done only on the return value. The stored value is unchanged. -
get
Return the value for the given key converted to the type of the default value. If the value is null, defaultValue is returned. Conversion is done usingget(String, Class) -
put
Like normalMap.put(Object, Object)operation, but if null is passed as "value" it removes the key/value from the map. -
set
Works likeput(String, Object)but returns this SmartMap rather than the old value. -
remove
-
putAll
-
clear
public void clear() -
equals
-
hashCode
public int hashCode() -
keySet
-
values
-
entrySet
-