Package com.streamconverter.path
Class TreePath
java.lang.Object
com.streamconverter.path.TreePath
Represents a hierarchical path for tree-like data structures (JSON, XML).
This class handles parsing and matching of path expressions in both JSON-style ("$.user.name") and XML-style ("user/name") formats. It converts path expressions into hierarchical segments for efficient matching during data processing.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static TreePath
Creates a TreePath from a JSON path expression.static TreePath
Creates a TreePath from an XML path expression.int
hashCode()
boolean
Checks if current path matches the target path segmentstoString()
Returns the original path expression.
-
Method Details
-
fromXml
Creates a TreePath from an XML path expression.- Parameters:
xmlPath
- the XML path expression (e.g., "user/name")- Returns:
- TreePath instance
- Throws:
IllegalArgumentException
- if xmlPath is null or invalid
-
fromJson
Creates a TreePath from a JSON path expression.- Parameters:
jsonPath
- the JSON path expression (e.g., "$.user.name")- Returns:
- TreePath instance
- Throws:
IllegalArgumentException
- if jsonPath is null or invalid
-
matches
Checks if current path matches the target path segments -
toString
Returns the original path expression. -
equals
-
hashCode
-