Interface PropertyPath

All Known Implementing Classes:
ConfigPath

public interface PropertyPath
Represents an immutable path through a property 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).

This interface provides a generic abstraction for property paths that can be used across the framework for validation, configuration, and other purposes.

  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    Converts the path to a dot-separated string.
    @NotNull PropertyPath
    child(@NotNull Object segment)
    Creates a child path by appending a segment.
    @NotNull Object[]
    Returns the path elements.
    boolean
    Checks if this path is empty (root path).
    @Nullable Object
    Returns the last element of the path.
    static @NotNull PropertyPath
    of(@NotNull Object... elements)
    Creates a path from the given elements.
    @NotNull PropertyPath
    Returns the parent path.
    static @NotNull PropertyPath
    parse(@NotNull String dotPath)
    Parses a dot-separated path string.
    static @NotNull PropertyPath
    Returns the root path (empty path).
    int
    Returns the number of elements in this path.
  • Method Details

    • root

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

      @NotNull static @NotNull PropertyPath 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 static @NotNull PropertyPath 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 @NotNull PropertyPath child(@NotNull @NotNull Object segment)
      Creates a child path by appending a segment.
      Parameters:
      segment - the segment to append (String or Integer)
      Returns:
      a new path with the segment appended
    • parent

      @NotNull @NotNull PropertyPath parent()
      Returns the parent path.
      Returns:
      the parent path, or root if this is already root
    • elements

      @NotNull @NotNull Object[] elements()
      Returns the path elements.
      Returns:
      a copy of the elements array
    • size

      int size()
      Returns the number of elements in this path.
      Returns:
      the path length
    • isEmpty

      boolean isEmpty()
      Checks if this path is empty (root path).
      Returns:
      true if this is the root path
    • last

      @Nullable @Nullable Object last()
      Returns the last element of the path.
      Returns:
      the last element, or null if empty
    • asString

      @NotNull @NotNull String asString()
      Converts the path to a dot-separated string.
      Returns:
      the path as a string