![JAR search and dependency download from the Maven repository](/logo.png)
org.nlab.json.stream.predicate.JsonPathPredicate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-stream Show documentation
Show all versions of json-stream Show documentation
Json Streaming / JsonPath Matcher
The newest version!
package org.nlab.json.stream.predicate;
import java.util.concurrent.atomic.AtomicBoolean;
import org.nlab.json.stream.context.StreamContext;
import org.nlab.json.stream.jsonpath.evaluation.EvaluatePath;
import org.nlab.json.stream.jsonpath.path.PathNode;
/**
* Created by nlabrot on 15/03/15.
*/
public class JsonPathPredicate implements JsonPredicate {
private PathNode pathNode;
public JsonPathPredicate(PathNode pathNode) {
this.pathNode = pathNode;
}
@Override
public boolean test(StreamContext streamContext) {
AtomicBoolean found = new AtomicBoolean(false);
EvaluatePath nodeSelector = new EvaluatePath(c -> {
found.set(true);
});
nodeSelector.evaluateNext(streamContext , 0 , pathNode);
return found.get();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy