Class Tree
java.lang.Object
org.polyfrost.oneconfig.api.config.v1.Node
org.polyfrost.oneconfig.api.config.v1.Tree
- All Implemented Interfaces:
Serializable
The Tree class represents a tree structure that contains properties and other trees as children.
It provides various methods to access, modify, and compare the tree and its elements.
- See Also:
-
Field Summary
FieldsFields inherited from class org.polyfrost.oneconfig.api.config.v1.Node
description, LOGGER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidvoidclear()Clear this tree of all its members.booleandeepEquals(@Nullable Object obj) Check if the tree's contents equals another tree's.booleanstatic StringevaluatePath(Tree root, Node node) Figure out what the path from the given root to the given node is.@Nullable Node@Nullable Node@Nullable NodegetOrPutChild(@NotNull String id) Property<?> Property<?> voidonAll(BiConsumer<String, Node> action) voidonAllProps(BiConsumer<String, Property<?>> action) voidoverwrite(@NotNull Node with, boolean preserveMissingOptions, boolean skipOverwritten, @Nullable Tree root) Overwrite all data in this node with the data from another node.voidoverwrite(Tree with, @NotNull Function<String, String> keyMapper, boolean preserveMissingOptions, boolean skipOverwritten, @Nullable Tree root) Overwrite this tree with the supplied tree, using the keyMapper to map between key names from old to new if needed.toString()static @NotNull Treetree()static @NotNull Treestatic @NotNull TreeCreate a new builder from the given tree.unpack()Unpack this tree into a map of objects, containing either more Maps or the values of the properties of this tree.Methods inherited from class org.polyfrost.oneconfig.api.config.v1.Node
addMetadata, addMetadata, clearMetadata, consumeMetadata, getID, getMetadata, getMetadata, getOrPutMetadata, getTitle, hashCode, hasMetadata, overwrite, removeMetadata, setID, setTitle, strv
-
Field Details
-
map
-
-
Constructor Details
-
Tree
-
-
Method Details
-
beginFailureCollection
@Internal public static void beginFailureCollection() -
endFailureCollection
-
tree
-
tree
-
tree
Create a new builder from the given tree. This will copy all the data from the tree into the builder. -
put
-
put
-
set
-
get
-
get
-
get
-
getChild
-
getChild
-
getOrPutChild
-
getProp
-
getProp
-
onAll
-
onAllProps
-
equals
-
deepEquals
Check if the tree's contents equals another tree's. This will check the values and children of the tree.- Specified by:
deepEqualsin classNode- Parameters:
obj- the tree to check against- Returns:
- whether the trees are equal
-
overwrite
public void overwrite(Tree with, @NotNull @NotNull Function<String, String> keyMapper, boolean preserveMissingOptions, boolean skipOverwritten, @Nullable @Nullable Tree root) Overwrite this tree with the supplied tree, using the keyMapper to map between key names from old to new if needed.- Parameters:
with- the tree to overwrite withkeyMapper- the key mapper function to use
-
overwrite
public void overwrite(@NotNull @NotNull Node with, boolean preserveMissingOptions, boolean skipOverwritten, @Nullable @Nullable Tree root) Description copied from class:NodeOverwrite all data in this node with the data from another node.- Specified by:
overwritein classNode- Parameters:
with- the node to overwrite this withpreserveMissingOptions- if true, any properties that are missing in THIS tree that are present in the input tree, will be added to this tree.skipOverwritten- **DEPENDS ON PARAM "ROOT" BEING NOT NULL** - skips being overwritten if a child node has already been marked as overwritten in the root tree.root- The root tree used to mark overwritten nodes for skipOverwritten. May be null if skipOverwritten is false.
-
unpack
Unpack this tree into a map of objects, containing either more Maps or the values of the properties of this tree. -
toString
-
contentToString
-
clear
@Internal public void clear()Clear this tree of all its members.
This function is used internally to discard trees to prevent illegal usage of 'dead' trees. -
evaluatePath
Figure out what the path from the given root to the given node is.
-