Package net.solarnetwork.node.dao
Class DefaultTransientSettingDao
java.lang.Object
java.util.AbstractMap<K,V>
java.util.concurrent.ConcurrentHashMap<String,ConcurrentMap<String,Object>>
net.solarnetwork.node.dao.DefaultTransientSettingDao
- All Implemented Interfaces:
Serializable,ConcurrentMap<String,,ConcurrentMap<String, Object>> Map<String,,ConcurrentMap<String, Object>> TransientSettingDao
public class DefaultTransientSettingDao
extends ConcurrentHashMap<String,ConcurrentMap<String,Object>>
implements TransientSettingDao
Default implementation of
TransientSettingDao.- Since:
- 2.5
- Version:
- 1.0
- Author:
- matt
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap
ConcurrentHashMap.KeySetView<K extends Object,V extends Object> Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThesettingsConcurrencyLevelproperty default value.static final intThesettingsInitialCapacityproperty default value.static final floatThesettingsLoadFactorproperty default value. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DefaultTransientSettingDao(int initialCapacity) Constructor.DefaultTransientSettingDao(int initialCapacity, float loadFactor) Constructor.DefaultTransientSettingDao(int initialCapacity, float loadFactor, int concurrencyLevel) Constructor.DefaultTransientSettingDao(Map<? extends String, ? extends ConcurrentMap<String, Object>> m) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintGet the concurrency level used for settings maps.intGet the initial capacity used for settings maps.floatGet the load factory used for settings maps.voidsetSettingsConcurrencyLevel(int settingsConcurrencyLevel) Set the concurrency level used for settings maps.voidsetSettingsInitialCapacity(int settingsInitialCapacity) Set the initial capacity used for settings maps.voidsetSettingsLoadFactor(float settingsLoadFactor) Set the load factory used for settings maps.<V> ConcurrentMap<String,V> Get the settings map for a given key.Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, valuesMethods inherited from class java.util.AbstractMap
clone
-
Field Details
-
DEFAULT_SETTINGS_INITIAL_CAPACITY
public static final int DEFAULT_SETTINGS_INITIAL_CAPACITYThesettingsInitialCapacityproperty default value.- See Also:
-
DEFAULT_SETTINGS_LOAD_FACTOR
public static final float DEFAULT_SETTINGS_LOAD_FACTORThesettingsLoadFactorproperty default value.- See Also:
-
DEFAULT_SETTINGS_CONCURRENCY_LEVEL
public static final int DEFAULT_SETTINGS_CONCURRENCY_LEVELThesettingsConcurrencyLevelproperty default value.- See Also:
-
-
Constructor Details
-
DefaultTransientSettingDao
public DefaultTransientSettingDao()Default constructor. -
DefaultTransientSettingDao
public DefaultTransientSettingDao(int initialCapacity) Constructor.- Parameters:
initialCapacity- the initial capacity hint
-
DefaultTransientSettingDao
Constructor.- Parameters:
m- another map to copy values from
-
DefaultTransientSettingDao
public DefaultTransientSettingDao(int initialCapacity, float loadFactor) Constructor.- Parameters:
initialCapacity- the initial capacity hintloadFactor- a load factor hint
-
DefaultTransientSettingDao
public DefaultTransientSettingDao(int initialCapacity, float loadFactor, int concurrencyLevel) Constructor.- Parameters:
initialCapacity- the initial capacity hintloadFactor- a load factor hintconcurrencyLevel- a concurrency level hint
-
-
Method Details
-
settings
Description copied from interface:TransientSettingDaoGet the settings map for a given key.This method will always return the same map instance for a given key.
- Specified by:
settingsin interfaceTransientSettingDao- Type Parameters:
V- the value type to cast to; note this is only a generic casting operation for convenience and the actual map is expected to actually be declared asConcurrentMap<String, Object>- Parameters:
key- the settings key to get- Returns:
- the settings for the given key, never null
-
getSettingsInitialCapacity
public int getSettingsInitialCapacity()Get the initial capacity used for settings maps.- Returns:
- the initial capacity; defaults to
DEFAULT_SETTINGS_INITIAL_CAPACITY
-
setSettingsInitialCapacity
public void setSettingsInitialCapacity(int settingsInitialCapacity) Set the initial capacity used for settings maps.- Parameters:
settingsInitialCapacity- the capacity to set
-
getSettingsLoadFactor
public float getSettingsLoadFactor()Get the load factory used for settings maps.- Returns:
- the load factor; defaults to
DEFAULT_SETTINGS_LOAD_FACTOR
-
setSettingsLoadFactor
public void setSettingsLoadFactor(float settingsLoadFactor) Set the load factory used for settings maps.- Parameters:
settingsLoadFactor- the load factor to set
-
getSettingsConcurrencyLevel
public int getSettingsConcurrencyLevel()Get the concurrency level used for settings maps.- Returns:
- the concurrency level; defaults to
DEFAULT_SETTINGS_CONCURRENCY_LEVEL
-
setSettingsConcurrencyLevel
public void setSettingsConcurrencyLevel(int settingsConcurrencyLevel) Set the concurrency level used for settings maps.- Parameters:
settingsConcurrencyLevel- the concurrency level to set
-