JsonPath仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.0 KiB

package com.jayway.jsonpath.internal;
12 years ago
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.internal.compiler.EvaluationContextImpl;
import com.jayway.jsonpath.internal.compiler.PathToken;
12 years ago
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CompiledPath implements Path {
12 years ago
private static final Logger logger = LoggerFactory.getLogger(CompiledPath.class);
private final PathToken root;
public CompiledPath(PathToken root) {
this.root = root;
}
@Override
public EvaluationContext evaluate(Object model, Configuration configuration) {
if(logger.isDebugEnabled()) {
logger.debug("Evaluating path: {}", toString());
}
11 years ago
EvaluationContextImpl ctx = new EvaluationContextImpl(this, configuration);
12 years ago
root.evaluate("", model, ctx);
return ctx;
}
@Override
public boolean isDefinite() {
return root.isPathDefinite();
}
@Override
public String toString() {
return root.toString();
}
}