本文整理汇总了Java中io.github.medjed.jsonpathcompiler.expressions.path.ArrayPathToken类的典型用法代码示例。如果您正苦于以下问题:Java ArrayPathToken类的具体用法?Java ArrayPathToken怎么用?Java ArrayPathToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArrayPathToken类属于io.github.medjed.jsonpathcompiler.expressions.path包,在下文中一共展示了ArrayPathToken类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertSupportedPathToken
import io.github.medjed.jsonpathcompiler.expressions.path.ArrayPathToken; //导入依赖的package包/类
protected static void assertSupportedPathToken(PathToken pathToken, String path)
{
if (pathToken instanceof ArrayPathToken) {
ArrayIndexOperation arrayIndexOperation = ((ArrayPathToken) pathToken).getArrayIndexOperation();
assertSupportedArrayPathToken(arrayIndexOperation, path);
}
else if (pathToken instanceof ScanPathToken) {
throw new ConfigException(String.format("scan path token is not supported \"%s\"", path));
}
else if (pathToken instanceof FunctionPathToken) {
throw new ConfigException(String.format("function path token is not supported \"%s\"", path));
}
else if (pathToken instanceof PredicatePathToken) {
throw new ConfigException(String.format("predicate path token is not supported \"%s\"", path));
}
}
示例2: assertSupportedPathToken
import io.github.medjed.jsonpathcompiler.expressions.path.ArrayPathToken; //导入依赖的package包/类
public static void assertSupportedPathToken(PathToken pathToken, String path)
{
if (pathToken instanceof ArrayPathToken) {
ArrayIndexOperation arrayIndexOperation = ((ArrayPathToken) pathToken).getArrayIndexOperation();
assertSupportedArrayPathToken(arrayIndexOperation, path);
}
else if (pathToken instanceof ScanPathToken) {
throw new ConfigException(String.format("scan path token is not supported \"%s\"", path));
}
else if (pathToken instanceof FunctionPathToken) {
throw new ConfigException(String.format("function path token is not supported \"%s\"", path));
}
else if (pathToken instanceof PredicatePathToken) {
throw new ConfigException(String.format("predicate path token is not supported \"%s\"", path));
}
}
示例3: getTailIndex
import io.github.medjed.jsonpathcompiler.expressions.path.ArrayPathToken; //导入依赖的package包/类
public static Long getTailIndex(String path)
{
Path compiledPath = PathCompiler.compile(path);
PathToken tail = ((RootPathToken) compiledPath.getRoot()).getTail();
if (tail instanceof ArrayPathToken) {
ArrayIndexOperation arrayIndexOperation = ((ArrayPathToken) tail).getArrayIndexOperation();
if (arrayIndexOperation == null) {
throw new ConfigException(String.format("Array Slice Operation is not supported \"%s\"", path));
}
if (arrayIndexOperation.isSingleIndexOperation()) {
return arrayIndexOperation.indexes().get(0).longValue();
}
else {
throw new ConfigException(String.format("Multi Array Indexes is not supported \"%s\"", path));
}
}
else {
return null;
}
}