Class ConfigNode
java.lang.Object
com.djrapitops.plan.settings.config.ConfigNode
- Direct Known Subclasses:
Config
Represents a single node in a configuration file
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String, ConfigNode> protected final Stringprotected final UnitSemaphoreAccessLockprotected ConfigNodeprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ConfigNodeaddChild(ConfigNode child) Add a new child ConfigNode.booleanvoidcopyAll(ConfigNode from) voidcopyMissing(ConfigNode from) voidcopyValue(ConfigNode from) <T> List<T> dfs(BiConsumer<ConfigNode, List<T>> accessVisitor) booleanbooleanbooleangetBoolean(String path) getInteger(String path) getKey(boolean deep) getLong()protected intgetStringList(String path) getStringMap(boolean fullKeys) Return values in a Map.inthashCode()booleanbooleanMoves a node from old path to new path.voidremove()protected voidremoveChild(ConfigNode child) booleanremoveNode(String path) Remove a node at a certain path.voidvoidsave()Find the root node and save.<T> void<T> voidset(T value) voidsetComment(List<String> comment) voidsort()toString()protected voidupdateParent(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:
trueif the node was present and is now removed.falseif 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:
trueif the move was successful.falseif 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.
-
getConfigPaths
- Returns:
- List of config keys
-
dfs
-
getInteger
-
getLong
-
getString
-
getBoolean
-
getDouble
-
copyMissing
-
copyAll
-
copyValue
-
getNodeDepth
protected int getNodeDepth() -
getParent
-
isLeafNode
public boolean isLeafNode() -
getNodeOrder
-
getChildren
-
equals
-
hashCode
public int hashCode() -
toString
-