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