Package com.landawn.abacus.util
Class Properties<K,V>
java.lang.Object
com.landawn.abacus.util.Properties<K,V>
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
Map<K,
V>
- Since:
- 0.8
- Author:
- Haiyang Li
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear.boolean
containsKey
(Object key) boolean
containsValue
(Object value) Properties<K,
V> copy()
entrySet()
boolean
static <K,
V> Properties<K, V> <T> T
To avoidNullPointerException
for primitive type if the target property is null or not set.<T> T
getOrDefault
(Object propName, T defaultValue, Class<T> targetType) Gets the or default.getOrDefault
(Object propName, V defaultValue) Gets the or default.int
hashCode()
boolean
isEmpty()
Checks if is empty.keySet()
void
putIfAbsent
(K key, V value) Put if absent.boolean
Removes the entry for the specified key only if it is currently mapped to the specified value.Replaces the entry for the specified key only if it is currently mapped to some value.boolean
Replaces the entry for the specified key only if currently mapped to the specified value.Properties<K,
V> int
size()
toString()
values()
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, merge, replaceAll
-
Constructor Details
-
Properties
public Properties()
-
-
Method Details
-
from
- Type Parameters:
K
- the key typeV
- the value type- Parameters:
map
-- Returns:
-
get
-
get
To avoidNullPointerException
for primitive type if the target property is null or not set.- Type Parameters:
T
-- Parameters:
propName
-targetType
-- Returns:
-
getOrDefault
Gets the or default.- Specified by:
getOrDefault
in interfaceMap<K,
V> - Parameters:
propName
-defaultValue
- is returned if the specifiedpropName
is not contained in this Properties instance or it's null.- Returns:
-
getOrDefault
Gets the or default.- Type Parameters:
T
-- Parameters:
propName
-defaultValue
- is returned if the specifiedpropName
is not contained in this Properties instance or it's null.targetType
-- Returns:
-
set
- Parameters:
propName
-propValue
-- Returns:
-
put
-
putAll
-
putIfAbsent
Put if absent.- Specified by:
putIfAbsent
in interfaceMap<K,
V> - Parameters:
key
-value
-- Returns:
-
remove
-
remove
Removes the entry for the specified key only if it is currently mapped to the specified value. -
replace
Replaces the entry for the specified key only if it is currently mapped to some value. -
replace
Replaces the entry for the specified key only if currently mapped to the specified value. -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Parameters:
key
-- Returns:
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V> - Parameters:
value
-- Returns:
-
keySet
-
values
-
entrySet
-
isEmpty
public boolean isEmpty()Checks if is empty. -
size
public int size() -
clear
public void clear()Clear. -
copy
-
hashCode
public int hashCode() -
equals
-
toString
-