use of com.jayway.jsonpath.internal.Path in project JsonPath by jayway.
the class PathCompiler method compile.
public static Path compile(String path, final Predicate... filters) {
try {
path = path.trim();
if (!(path.charAt(0) == DOC_CONTEXT) && !(path.charAt(0) == EVAL_CONTEXT)) {
path = "$." + path;
}
if (path.endsWith(".")) {
fail("Path must not end with a '.' or '..'");
}
LinkedList filterStack = new LinkedList<Predicate>(asList(filters));
Path p = new PathCompiler(path.trim(), filterStack).compile();
return p;
} catch (Exception e) {
InvalidPathException ipe;
if (e instanceof InvalidPathException) {
ipe = (InvalidPathException) e;
} else {
ipe = new InvalidPathException(e);
}
throw ipe;
}
}
Aggregations