java.lang.Object
tech.guilhermekaua.spigotboot.core.validation.ConfigPath
All Implemented Interfaces:
PropertyPath

public final class ConfigPath extends Object implements 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 Details

    • root

      @NotNull public static @NotNull ConfigPath root()
      Returns the root path (empty path).
      Returns:
      the root path
    • of

      @NotNull public static @NotNull ConfigPath of(@NotNull @NotNull Object... elements)
      Creates a path from the given elements.
      Parameters:
      elements - the path elements (strings or integers)
      Returns:
      a new path
    • parse

      @NotNull public static @NotNull ConfigPath parse(@NotNull @NotNull String dotPath)
      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

      @NotNull public @NotNull ConfigPath child(@NotNull @NotNull Object segment)
      Description copied from interface: PropertyPath
      Creates a child path by appending a segment.
      Specified by:
      child in interface PropertyPath
      Parameters:
      segment - the segment to append (String or Integer)
      Returns:
      a new path with the segment appended
    • parent

      @NotNull public @NotNull ConfigPath parent()
      Description copied from interface: PropertyPath
      Returns the parent path.
      Specified by:
      parent in interface PropertyPath
      Returns:
      the parent path, or root if this is already root
    • elements

      @NotNull public @NotNull Object[] elements()
      Description copied from interface: PropertyPath
      Returns the path elements.
      Specified by:
      elements in interface PropertyPath
      Returns:
      a copy of the elements array
    • size

      public int size()
      Description copied from interface: PropertyPath
      Returns the number of elements in this path.
      Specified by:
      size in interface PropertyPath
      Returns:
      the path length
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: PropertyPath
      Checks if this path is empty (root path).
      Specified by:
      isEmpty in interface PropertyPath
      Returns:
      true if this is the root path
    • last

      @Nullable public @Nullable Object last()
      Description copied from interface: PropertyPath
      Returns the last element of the path.
      Specified by:
      last in interface PropertyPath
      Returns:
      the last element, or null if empty
    • asString

      @NotNull public @NotNull String asString()
      Description copied from interface: PropertyPath
      Converts the path to a dot-separated string.
      Specified by:
      asString in interface PropertyPath
      Returns:
      the path as a string
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object