Class AbstractValueConfigNode
java.lang.Object
tech.guilhermekaua.spigotboot.config.node.AbstractValueConfigNode
- All Implemented Interfaces:
ConfigNode
- Direct Known Subclasses:
SnapshotConfigNode,YamlConfigNode
Shared immutable/read-only behavior for value-backed
ConfigNode implementations.
Subclasses provide storage details and child-node creation strategy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull List<? extends ConfigNode>Gets all children as a list (for list nodes).@NotNull Map<String,? extends ConfigNode> Gets all children as a map (for map nodes).protected abstract @NotNull ConfigNodecreateChildNode(@Nullable Object value, @NotNull PropertyPath path, boolean virtual) protected abstract @NotNull PropertyPathprotected abstract @Nullable Objectprotected abstract boolean<T> TGets the value converted to the specified type.<T> TGets the value converted to the specified type, with a default fallback.booleanChecks if this node has a child at the given path.booleanisList()Checks if this node is a list (array) node.booleanisMap()Checks if this node is a map (object) node.booleanisNull()Checks if this node's value is null.booleanisScalar()Checks if this node is a scalar (primitive/string) value.booleanChecks if this node is virtual (doesn't exist in the source).@NotNull ConfigNodeNavigates to a child node by path segments.@NotNull ConfigNodenode(@NotNull PropertyPath path) Navigates to a child node by a property path.@NotNull PropertyPathpath()Gets the path to this node from root.@Nullable Objectraw()Gets the raw underlying value.
-
Constructor Details
-
AbstractValueConfigNode
public AbstractValueConfigNode()
-
-
Method Details
-
currentValue
-
currentPath
-
currentVirtual
protected abstract boolean currentVirtual() -
createChildNode
@NotNull protected abstract @NotNull ConfigNode createChildNode(@Nullable @Nullable Object value, @NotNull @NotNull PropertyPath path, boolean virtual) -
raw
Description copied from interface:ConfigNodeGets the raw underlying value.- Specified by:
rawin interfaceConfigNode- Returns:
- the raw value, or null if the node is empty
-
get
Description copied from interface:ConfigNodeGets the value converted to the specified type.- Specified by:
getin interfaceConfigNode- Type Parameters:
T- the type parameter- Parameters:
type- the target type- Returns:
- the converted value, or null if conversion fails or value is null
-
get
Description copied from interface:ConfigNodeGets the value converted to the specified type, with a default fallback.- Specified by:
getin interfaceConfigNode- Type Parameters:
T- the type parameter- Parameters:
type- the target typedefaultValue- the default value if conversion fails or value is null- Returns:
- the converted value or the default
-
node
Description copied from interface:ConfigNodeNavigates to a child node by path segments.If the path doesn't exist, returns a virtual (empty) node.
- Specified by:
nodein interfaceConfigNode- Parameters:
pathSegments- the path segments (strings for map keys, integers for list indices)- Returns:
- the child node, never null
-
node
Description copied from interface:ConfigNodeNavigates to a child node by a property path.If the path doesn't exist, returns a virtual (empty) node.
- Specified by:
nodein interfaceConfigNode- Parameters:
path- thePropertyPathto navigate to- Returns:
- the child node, never null
-
hasChild
Description copied from interface:ConfigNodeChecks if this node has a child at the given path.- Specified by:
hasChildin interfaceConfigNode- Parameters:
path- the path segments- Returns:
- true if the child exists and is not virtual
-
childrenMap
Description copied from interface:ConfigNodeGets all children as a map (for map nodes).- Specified by:
childrenMapin interfaceConfigNode- Returns:
- the children map, or empty map if not a map node
-
childrenList
Description copied from interface:ConfigNodeGets all children as a list (for list nodes).- Specified by:
childrenListin interfaceConfigNode- Returns:
- the children list, or empty list if not a list node
-
isMap
public boolean isMap()Description copied from interface:ConfigNodeChecks if this node is a map (object) node.- Specified by:
isMapin interfaceConfigNode- Returns:
- true if this node contains key-value pairs
-
isList
public boolean isList()Description copied from interface:ConfigNodeChecks if this node is a list (array) node.- Specified by:
isListin interfaceConfigNode- Returns:
- true if this node contains a list of values
-
isScalar
public boolean isScalar()Description copied from interface:ConfigNodeChecks if this node is a scalar (primitive/string) value.- Specified by:
isScalarin interfaceConfigNode- Returns:
- true if this node contains a scalar value
-
isNull
public boolean isNull()Description copied from interface:ConfigNodeChecks if this node's value is null.- Specified by:
isNullin interfaceConfigNode- Returns:
- true if the value is null
-
isVirtual
public boolean isVirtual()Description copied from interface:ConfigNodeChecks if this node is virtual (doesn't exist in the source).Virtual nodes are returned when navigating to non-existent paths.
- Specified by:
isVirtualin interfaceConfigNode- Returns:
- true if this node is virtual
-
path
Description copied from interface:ConfigNodeGets the path to this node from root.- Specified by:
pathin interfaceConfigNode- Returns:
- the path to this node
-