public class DefaultPreferencesNode extends AbstractPreferencesNode
Modifier and Type | Field and Description |
---|---|
protected Object |
lock |
protected Map<String,PreferencesNode> |
nodes |
protected Map<String,Object> |
properties |
name, parent, path, preferences
PATH_SEPARATOR
Constructor and Description |
---|
DefaultPreferencesNode(Preferences preferences,
PreferencesNode parent,
String name) |
Modifier and Type | Method and Description |
---|---|
Map<String,PreferencesNode> |
children() |
void |
clear() |
boolean |
containsKey(String key) |
PreferencesNode |
createChildNode(String nodeName) |
protected void |
firePreferencesChanged(String path,
String key,
Object oldValue,
Object newValue) |
<T> T |
getAs(String key)
Returns the value associated with the given key.
|
<T> T |
getAs(String key,
T defaultValue)
Returns the value associated with the given key.
|
Object |
getAt(String key)
Returns the value associated with the given key.
|
Object |
getAt(String key,
Object defaultValue)
Returns the value associated with the given key.
|
PreferencesNode |
getChildNode(String nodeName) |
<T> T |
getConverted(String key,
Class<T> type)
Finds a value associated with the given key.
|
<T> T |
getConverted(String key,
Class<T> type,
T defaultValue)
Finds a value associated with the given key.
|
String[] |
keys() |
void |
putAt(String key,
Object value) |
void |
remove(String key) |
PreferencesNode |
removeChildNode(String nodeName) |
void |
storeChildNode(String nodeName,
PreferencesNode node) |
containsNode, containsNode, isRoot, merge, name, node, node, parent, parsePath, path, removeNode, removeNode
protected final Object lock
protected final Map<String,PreferencesNode> nodes
public DefaultPreferencesNode(@Nonnull Preferences preferences, @Nonnull PreferencesNode parent, @Nonnull String name)
@Nullable public Object getAt(@Nonnull String key)
PreferencesNode
key
- the key to search@Nullable public Object getAt(@Nonnull String key, @Nullable Object defaultValue)
PreferencesNode
key
- the key to searchdefaultValue
- the value to be returned if the key was not found@Nullable public <T> T getAs(@Nonnull String key)
PreferencesNode
T
- the type of the valuekey
- the key to search@Nullable public <T> T getAs(@Nonnull String key, @Nullable T defaultValue)
PreferencesNode
T
- the type of the valuekey
- the key to searchdefaultValue
- the value to be returned if the key was not found@Nullable public <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type)
PreferencesNode
PropertyEditor
.key
- the key to searchtype
- the type to be returned@Nullable public <T> T getConverted(@Nonnull String key, @Nonnull Class<T> type, @Nullable T defaultValue)
PreferencesNode
PropertyEditor
.
If not found then the supplied defaultValue will be returned.key
- the key to searchtype
- the type to be returneddefaultValue
- the value to be returned if the key is not foundprotected void firePreferencesChanged(@Nonnull String path, @Nonnull String key, @Nullable Object oldValue, @Nullable Object newValue)
public void clear()
@Nonnull public Map<String,PreferencesNode> children()
@Nonnull public PreferencesNode createChildNode(@Nonnull String nodeName)
public void storeChildNode(@Nonnull String nodeName, @Nonnull PreferencesNode node)
@Nullable public PreferencesNode removeChildNode(@Nonnull String nodeName)
@Nullable public PreferencesNode getChildNode(@Nonnull String nodeName)