Class Node
java.lang.Object
org.polyfrost.oneconfig.api.config.v1.Node
-
Field Summary
FieldsModifier and TypeFieldDescription@Nullable Objectprotected static final org.apache.logging.log4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddMetadata(String key, Object value) final voidaddMetadata(Map<String, Object> metadata) protected final voidfinal <M> MconsumeMetadata(String key) Consume some metadata attached to this node, meaning it will be removed.abstract booleandeepEquals(Object other) getID()The ID of this node.final <M> MgetMetadata(String key) Return some metadata attached to this node.final <M> MgetOrPutMetadata(String key, Supplier<M> def) Return some metadata attached to this node, or put def it is isn't present.@Nullable ObjectgetTitle()final inthashCode()final booleanvoidabstract voidOverwrite all data in this node with the data from another node.final booleanremoveMetadata(String key) voidSet the ID of this node.voidstatic Objectvalidate and trim the given string, returning null if it is empty.
-
Field Details
-
LOGGER
protected static final org.apache.logging.log4j.Logger LOGGER -
description
-
-
Constructor Details
-
Node
-
-
Method Details
-
strv
validate and trim the given string, returning null if it is empty. -
getID
The ID of this node. -
setID
Set the ID of this node. the ID is used solely by the backend to identify it. It may only contain alphanumeric characters, and underscores.
note that this operation is permanent and cannot be undone/changed! -
getTitle
-
setTitle
-
addMetadata
-
addMetadata
-
removeMetadata
-
getMetadata
Return some metadata attached to this node.- Type Parameters:
M- the type of the metadata- Parameters:
key- the key of the metadata- Returns:
- the metadata, or null if it doesn't exist
- Throws:
ClassCastException- if the metadata is not of the expected type M
-
getOrPutMetadata
Return some metadata attached to this node, or put def it is isn't present.- Type Parameters:
M- the type of the metadata- Parameters:
key- the key of the metadatadef- the default value to put if there currently is no metadata on this value- Returns:
- the metadata, or null if it doesn't exist
-
consumeMetadata
Consume some metadata attached to this node, meaning it will be removed.- Type Parameters:
M- the type of the metadata- Parameters:
key- the key of the metadata- Returns:
- the metadata, or null if it doesn't exist
-
getMetadata
-
clearMetadata
protected final void clearMetadata() -
hasMetadata
public final boolean hasMetadata() -
overwrite
-
overwrite
public abstract void overwrite(Node with, boolean preserveMissingOptions, boolean skipOverwritten, @Nullable @Nullable Tree root) Overwrite all data in this node with the data from another node.- 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.
-
deepEquals
-
hashCode
public final int hashCode()
-