public class Properties<K,V>
extends java.lang.Object
implements java.util.Map<K,V>
Constructor and Description |
---|
Properties() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
Properties<K,V> |
copy() |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
boolean |
equals(java.lang.Object obj) |
static <K,V> Properties<K,V> |
from(java.util.Map<? extends K,? extends V> map) |
<T> T |
get(java.lang.Class<T> targetClass,
java.lang.Object propName)
To avoid
NullPointerException for primitive type if the target property is null or not set. |
V |
get(java.lang.Object propName) |
<T> T |
getOrDefault(java.lang.Class<T> targetClass,
java.lang.Object propName,
T defaultValue) |
V |
getOrDefault(java.lang.Object propName,
V defaultValue) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
putIfAbsent(K key,
V value) |
V |
remove(java.lang.Object key) |
boolean |
remove(java.lang.Object key,
java.lang.Object value)
Removes the entry for the specified key only if it is currently
mapped to the specified value.
|
V |
replace(K key,
V value)
Replaces the entry for the specified key only if it is
currently mapped to some value.
|
boolean |
replace(K key,
V oldValue,
V newValue)
Replaces the entry for the specified key only if currently
mapped to the specified value.
|
Properties<K,V> |
set(K propName,
V propValue) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection<V> |
values() |
public static <K,V> Properties<K,V> from(java.util.Map<? extends K,? extends V> map)
public <T> T get(java.lang.Class<T> targetClass, java.lang.Object propName)
NullPointerException
for primitive type if the target property is null or not set.targetClass
- propName
- public <T> T getOrDefault(java.lang.Class<T> targetClass, java.lang.Object propName, T defaultValue)
targetClass
- propName
- defaultValue
- is returned if the specified propName
is not contained in this Properties instance or it's null.public Properties<K,V> set(K propName, V propValue)
propName
- propValue
- public boolean remove(java.lang.Object key, java.lang.Object value)
public V replace(K key, V value)
public boolean replace(K key, V oldValue, V newValue)
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public Properties<K,V> copy()
public int hashCode()
public boolean equals(java.lang.Object obj)
public java.lang.String toString()
toString
in class java.lang.Object