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 removedabstract booleandeepEquals(Object other) getID()final <M> MgetMetadata(String key) Return some metadata attached to this nodefinal <M> MgetOrPutMetadata(String key, Supplier<M> def) Return some metadata attached to this node or put def if it is not present@Nullable ObjectgetTitle()final inthashCode()final booleanvoidabstract voidOverwrite all data in this node with the data from another node
For a node all metadata will be copied from the input onto this and any duplicate keys will be overwritten For aPropertythe value and callbacks and display conditions are copied onto this For aTreeall children and properties will be overwritten if they are present and this operation is recursivefinal booleanremoveMetadata(String key) voidSet the ID of this node
The ID is used solely by the backend to identify it and may only contain alphanumeric characters and underscores
note that this operation is permanent and cannot be undone or changedvoidstatic 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
-
setID
Set the ID of this node
The ID is used solely by the backend to identify it and may only contain alphanumeric characters and underscores
note that this operation is permanent and cannot be undone or 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 does not exist
- Throws:
ClassCastException- if the metadata is not of the expected type M
-
getOrPutMetadata
Return some metadata attached to this node or put def if it is not 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 does not 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 does not 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- For a node all metadata will be copied from the input onto this and any duplicate keys will be overwritten
- For a
Propertythe value and callbacks and display conditions are copied onto this - For a
Treeall children and properties will be overwritten if they are present and this operation is recursive
- Parameters:
with- the node to overwrite this withpreserveMissingOptions- if true then any properties missing in THIS tree that are present in the input tree will be added to this treeskipOverwritten- **DEPENDS ON PARAM "ROOT" BEING NOT NULL** skips being overwritten if a child node has already been marked as overwritten in the root treeroot- The root tree used to mark overwritten nodes for skipOverwritten
May be null if skipOverwritten is false
-
deepEquals
-
hashCode
public final int hashCode()
-