Class Document.Path

java.lang.Object
io.fluxcapacitor.common.search.Document.Path
Enclosing class:
Document

public static class Document.Path extends Object
Represents a navigable field access path for a Document entry.

A Path is used to locate or filter entries within a document's hierarchical structure (e.g., nested objects or arrays). It supports glob-based pattern matching and two normalized representations:

  • Short form: omits numeric indices used in list paths (e.g. items/price)
  • Long form: includes all components, such as array indices (e.g. items/0/price)

Examples


 new Path("customer/addresses/1/city").getShortValue(); // "customer/addresses/city"
 new Path("customer/addresses/1/city").getLongValue();  // "customer/addresses/1/city"
 

Paths are typically normalized during search and comparison to ensure consistent behavior regardless of source data structure.

See Also:
  • Field Details

    • EMPTY_PATH

      public static Document.Path EMPTY_PATH
      Singleton instance representing an empty path.
  • Constructor Details

    • Path

      public Path()
  • Method Details

    • split

      public static Stream<String> split(String path)
      Splits a path string into individual elements (unescaped), using / as the delimiter.
      Parameters:
      path - path string to split
      Returns:
      stream of path components (e.g. ["foo", "bar", "name"])
    • isLongPath

      public static boolean isLongPath(String queryPath)
      Determines whether a given path string qualifies as a "long path".

      A path is considered long if any of its components are numeric (indicating array indices).

      Parameters:
      queryPath - path string to analyze
      Returns:
      true if the path includes numeric segments, false otherwise
    • pathPredicate

      public static Predicate<Document.Path> pathPredicate(String queryPath)
      Constructs a predicate to match Document.Path instances against the given glob-style path query.

      Internally distinguishes between short and long paths for matching.

      Parameters:
      queryPath - a glob pattern such as foo/name
      Returns:
      a predicate that matches paths by their normalized form