Package jakarta.nosql
Interface Settings
-
public interface Settings
The interface represents the settings used in a configuration.- See Also:
of(Map[])
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Settings.SettingsBuilder
The Settings builderSettings
static interface
Settings.SettingsBuilderProvider
A provider ofSettings.SettingsBuilder
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Settings.SettingsBuilder
builder()
Creates aSettings.SettingsBuilder
void
computeIfAbsent(String key, Function<String,Object> action)
If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.void
computeIfPresent(String key, BiConsumer<String,Object> action)
If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value.boolean
containsKey(String key)
Returns true if this map contains a mapping for the specified key.Set<Map.Entry<String,Object>>
entrySet()
Returns a Set view of the mappings contained in this map.void
forEach(BiConsumer<String,Object> action)
Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.Optional<Object>
get(String key)
Returns the value to which the specified key is mapped, orOptional.empty()
if this map contains no mapping for the key.<T> Optional<T>
get(String key, Class<T> type)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.Optional<Object>
get(Collection<String> keys)
Returns the value to which the specified from one of these keys is mapped, orOptional.empty()
if this map contains no mapping for the key.Object
getOrDefault(String key, Object defaultValue)
Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.boolean
isEmpty()
Set<String>
keySet()
Returns a Set view of the keys contained in this map.static Settings
of(Map<String,Object> settings)
Creates a settings from mapsstatic Settings
of(Map<String,Object>... settings)
Creates a settings from mapsList<Object>
prefix(String prefix)
Finds all keys that have the parameter as a prefixList<Object>
prefix(Collection<String> prefixes)
Finds all keys that have the parameter as a prefixint
size()
Map<String,Object>
toMap()
Converts the settings toMap
-
-
-
Method Detail
-
keySet
Set<String> keySet()
Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.- Returns:
- a set view of the keys contained in this map
-
get
Optional<Object> get(String key)
Returns the value to which the specified key is mapped, orOptional.empty()
if this map contains no mapping for the key.- Parameters:
key
- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
Optional.empty()
if this map contains no mapping for the key - Throws:
NullPointerException
- when key is null
-
get
Optional<Object> get(Collection<String> keys)
Returns the value to which the specified from one of these keys is mapped, orOptional.empty()
if this map contains no mapping for the key.- Parameters:
keys
- the key whose associated value is to be returned- Returns:
- the value to which the specified key is mapped, or
Optional.empty()
if this map contains no mapping for the key - Throws:
NullPointerException
- when keys is null
-
prefix
List<Object> prefix(String prefix)
Finds all keys that have the parameter as a prefix- Parameters:
prefix
- the prefix- Returns:
- all the keys from prefix
- Throws:
NullPointerException
- when prefix is null
-
prefix
List<Object> prefix(Collection<String> prefixes)
Finds all keys that have the parameter as a prefix- Parameters:
prefixes
- the list of prefixes- Returns:
- all the keys from prefix
- Throws:
NullPointerException
- when prefixes is null
-
get
<T> Optional<T> get(String key, Class<T> type)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.- Type Parameters:
T
- the type value- Parameters:
key
- the key whose associated value is to be returnedtype
- the type be used asValue.get(Class)
- Returns:
- the value to which the specified key is mapped, or
Optional.empty()
if this map contains no mapping for the key - Throws:
NullPointerException
- when there are null parameters
-
getOrDefault
Object getOrDefault(String key, Object defaultValue)
Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.- Parameters:
key
- the key whose associated value is to be returneddefaultValue
- the default mapping of the key- Returns:
- the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key
-
isEmpty
boolean isEmpty()
- Returns:
- Returns true if this map contains no key-value mappings.
-
size
int size()
- Returns:
- Returns the number of key-value mappings in this map.
-
containsKey
boolean containsKey(String key)
Returns true if this map contains a mapping for the specified key.- Parameters:
key
- key whose presence in this map is to be tested- Returns:
- true if this map contains a mapping for the specified key
- Throws:
NullPointerException
- when key is null
-
entrySet
Set<Map.Entry<String,Object>> entrySet()
Returns a Set view of the mappings contained in this map.- Returns:
- a set view of the mappings contained in this map
-
forEach
void forEach(BiConsumer<String,Object> action)
Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.- Parameters:
action
- the action- Throws:
NullPointerException
- when action is null
-
computeIfPresent
void computeIfPresent(String key, BiConsumer<String,Object> action)
If the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value.- Parameters:
key
- the keyaction
- the action- Throws:
NullPointerException
- when there is null parameter
-
computeIfAbsent
void computeIfAbsent(String key, Function<String,Object> action)
If the specified key is not already associated with a value (or is mapped to null), attempts to compute its value using the given mapping function and enters it into this map unless null.- Parameters:
key
- the keyaction
- the action- Throws:
NullPointerException
- when there is null parameter
-
builder
static Settings.SettingsBuilder builder()
Creates aSettings.SettingsBuilder
- Returns:
- a
Settings.SettingsBuilder
instance
-
of
static Settings of(Map<String,Object> settings)
Creates a settings from maps- Parameters:
settings
- the setting- Returns:
- the new
Settings
instance - Throws:
NullPointerException
- when either the parameter is null or there key or value null
-
of
@SafeVarargs static Settings of(Map<String,Object>... settings)
Creates a settings from maps- Parameters:
settings
- the setting- Returns:
- the new
Settings
instance - Throws:
NullPointerException
- when either the parameter is null or there key or value null
-
-