Package com.clickhouse.data
Class ClickHouseFreezableMap<K,V>
java.lang.Object
com.clickhouse.data.ClickHouseFreezableMap<K,V>
- All Implemented Interfaces:
Map<K,V>
Freezable map. Once the map is freezed, all writes will be discarded without
any error.
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()freeze()Freezes the map to discard write operations.booleanisEmpty()booleanChecks whether the map is freezed or not.protected booleanChecks whether the given key can be used in mutation(e.g.booleanisWhiteListed(K key) Checks whether the given key is whitelisted, meaning corresponding entry can be changed even the map is freezed.keySet()static <K,V> ClickHouseFreezableMap<K, V> Creates a freezable map with initial data and optional whitelisted keys.voidintsize()unfreeze()Unfreezes the map to accept write operations.values()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ClickHouseFreezableMap
-
-
Method Details
-
of
Creates a freezable map with initial data and optional whitelisted keys.- Type Parameters:
K- type of the keyV- type of the value- Parameters:
map- non-null map with initial datawhiteListedKeys- optional whitelisted keys- Returns:
- non-null freezable map
-
isMutable
Checks whether the given key can be used in mutation(e.g.put(),remove()), regardless the map is freezed or not.- Parameters:
key- non-null key- Returns:
- true if the given key can be used in mutation; false otherwise
-
clear
public void clear() -
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size() -
values
-
freeze
Freezes the map to discard write operations.- Returns:
- this map
-
unfreeze
Unfreezes the map to accept write operations.- Returns:
- this map
-
isFreezed
public boolean isFreezed()Checks whether the map is freezed or not.- Returns:
- true if the map is freezed; false otherwise
-
isWhiteListed
Checks whether the given key is whitelisted, meaning corresponding entry can be changed even the map is freezed.- Parameters:
key- non-null key- Returns:
- true if the key is whitelisted; false otherwise
-