All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.thisptr.jackson.jq.JsonQuery Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package net.thisptr.jackson.jq;

import com.fasterxml.jackson.databind.JsonNode;

import net.thisptr.jackson.jq.exception.JsonQueryException;
import net.thisptr.jackson.jq.internal.IsolatedScopeQuery;
import net.thisptr.jackson.jq.internal.javacc.ExpressionParser;

public class JsonQuery {
	private final Expression expr;

	private JsonQuery(final Expression expr) {
		this.expr = expr;
	}

	public void apply(final Scope scope, final JsonNode in, final Output output) throws JsonQueryException {
		expr.apply(scope, in, output);
	}

	public static JsonQuery compile(final String path, final Version version) throws JsonQueryException {
		return new JsonQuery(new IsolatedScopeQuery(ExpressionParser.compile(path, version)));
	}

	@Override
	public String toString() {
		return expr.toString();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy