Class ConfigNode
java.lang.Object
com.djrapitops.plan.settings.config.ConfigNode
- Direct Known Subclasses:
Config
Represents a single node in a configuration file
Based on https://github.com/AuroraLS3/Abstract-Plugin-Framework/blob/72e221d3571ef200727713d10d3684c51e9f469d/AbstractPluginFramework/api/src/main/java/com/djrapitops/plugin/config/ConfigNode.java
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,ConfigNode>
protected String
protected UnitSemaphoreAccessLock
protected ConfigNode
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ConfigNode
addChild(ConfigNode child)
Add a new child ConfigNode.boolean
void
copyAll(ConfigNode from)
void
copyMissing(ConfigNode from)
boolean
boolean
boolean
getBoolean(String path)
getInteger(String path)
getKey(boolean deep)
getLong()
protected int
getStringList(String path)
getStringMap(boolean fullKeys)
Return values in a Map.int
hashCode()
boolean
boolean
Moves a node from old path to new path.void
remove()
protected void
removeChild(ConfigNode child)
boolean
removeNode(String path)
Remove a node at a certain path.void
void
save()
Find the root node and save.<T> void
<T> void
set(T value)
void
setComment(List<String> comment)
void
sort()
toString()
protected void
updateParent(ConfigNode newParent)
-
Field Details
-
nodeModificationLock
-
key
-
parent
-
nodeOrder
-
childNodes
-
comment
-
value
-
-
Constructor Details
-
ConfigNode
-
-
Method Details
-
updateParent
-
getNode
-
contains
-
addNode
-
removeNode
Remove a node at a certain path.- Parameters:
path
- Path to the node that is up for removal.- Returns:
true
if the node was present and is now removed.false
if the path did not have a node.
-
remove
public void remove() -
addChild
Add a new child ConfigNode.- Parameters:
child
- ConfigNode to add. If from another config tree, the parent is 'cut', which breaks the old tree traversal.- Returns:
- Return the node given, now part of this tree.
-
removeChild
-
moveChild
Moves a node from old path to new path.- Parameters:
oldPath
- Old path of the node.newPath
- New path of the node.- Returns:
true
if the move was successful.false
if the new node is not present
-
getKey
-
sort
public void sort() -
reorder
-
save
Find the root node and save.- Throws:
IOException
- If the save can not be performed.
-
set
-
set
public <T> void set(T value) -
getComment
-
setComment
-
getStringList
-
getInteger
-
getLong
-
getString
-
getDouble
-
getBoolean
public boolean getBoolean() -
getStringList
-
getStringMap
Return values in a Map.- Parameters:
fullKeys
- Should the key be full keys of the Config node.- Returns:
- Map with Config key - ConfigNode#getString.
-
getInteger
-
getLong
-
getString
-
getBoolean
-
getDouble
-
copyMissing
-
copyAll
-
getNodeDepth
protected int getNodeDepth() -
getParent
-
isLeafNode
public boolean isLeafNode() -
getNodeOrder
-
getChildren
-
equals
-
hashCode
public int hashCode() -
toString
-