Class ConfigPath
java.lang.Object
tech.guilhermekaua.spigotboot.core.validation.ConfigPath
- All Implemented Interfaces:
PropertyPath
Represents an immutable path through the configuration tree.
Paths are sequences of keys that navigate from the root to a specific node. Supports both string keys (for maps) and integer indices (for lists).
-
Method Summary
Modifier and TypeMethodDescription@NotNull StringasString()Converts the path to a dot-separated string.@NotNull ConfigPathCreates a child path by appending a segment.@NotNull Object[]elements()Returns the path elements.booleaninthashCode()booleanisEmpty()Checks if this path is empty (root path).@Nullable Objectlast()Returns the last element of the path.static @NotNull ConfigPathCreates a path from the given elements.@NotNull ConfigPathparent()Returns the parent path.static @NotNull ConfigPathParses a dot-separated path string.static @NotNull ConfigPathroot()Returns the root path (empty path).intsize()Returns the number of elements in this path.toString()
-
Method Details
-
root
Returns the root path (empty path).- Returns:
- the root path
-
of
Creates a path from the given elements.- Parameters:
elements- the path elements (strings or integers)- Returns:
- a new path
-
parse
Parses a dot-separated path string.Example: "database.connection.host" becomes ["database", "connection", "host"]
- Parameters:
dotPath- the dot-separated path- Returns:
- a new path
-
child
Description copied from interface:PropertyPathCreates a child path by appending a segment.- Specified by:
childin interfacePropertyPath- Parameters:
segment- the segment to append (String or Integer)- Returns:
- a new path with the segment appended
-
parent
Description copied from interface:PropertyPathReturns the parent path.- Specified by:
parentin interfacePropertyPath- Returns:
- the parent path, or root if this is already root
-
elements
Description copied from interface:PropertyPathReturns the path elements.- Specified by:
elementsin interfacePropertyPath- Returns:
- a copy of the elements array
-
size
public int size()Description copied from interface:PropertyPathReturns the number of elements in this path.- Specified by:
sizein interfacePropertyPath- Returns:
- the path length
-
isEmpty
public boolean isEmpty()Description copied from interface:PropertyPathChecks if this path is empty (root path).- Specified by:
isEmptyin interfacePropertyPath- Returns:
- true if this is the root path
-
last
Description copied from interface:PropertyPathReturns the last element of the path.- Specified by:
lastin interfacePropertyPath- Returns:
- the last element, or null if empty
-
asString
Description copied from interface:PropertyPathConverts the path to a dot-separated string.- Specified by:
asStringin interfacePropertyPath- Returns:
- the path as a string
-
equals
-
hashCode
public int hashCode() -
toString
-