com.jayway.jsonpath
Class PathUtil
java.lang.Object
com.jayway.jsonpath.PathUtil
public class PathUtil
- extends Object
User: kalle stenflo
Date: 2/2/11
Time: 2:08 PM
|
Method Summary |
static boolean |
isPathDefinite(String jsonPath)
Checks if a path points to a single item or if it potentially returns multiple items
a path is considered not definite if it contains a scan fragment ".."
or an array position fragment that is not based on a single index
absolute path examples:
$store.book
$store.book[1].value
not absolute path examples
$..book
$.store.book[1,2]
$.store.book[?(@.category = 'fiction')] |
static List<String> |
splitPath(String jsonPath)
Splits a path into fragments
the path $.store.book[1].category returns ["$", "store", "book", "[1]", "value"] |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PathUtil
public PathUtil()
isPathDefinite
public static boolean isPathDefinite(String jsonPath)
- Checks if a path points to a single item or if it potentially returns multiple items
a path is considered not definite if it contains a scan fragment ".."
or an array position fragment that is not based on a single index
absolute path examples:
$store.book
$store.book[1].value
not absolute path examples
$..book
$.store.book[1,2]
$.store.book[?(@.category = 'fiction')]
- Parameters:
jsonPath - the path to check
- Returns:
- true if path is definite (points to single item)
splitPath
public static List<String> splitPath(String jsonPath)
- Splits a path into fragments
the path
$.store.book[1].category returns ["$", "store", "book", "[1]", "value"]
- Parameters:
jsonPath - path to split
- Returns:
- fragments
Copyright © 2011. All Rights Reserved.