本文整理了Java中com.jayway.jsonpath.Configuration.getEvaluationListeners()
方法的一些代码示例,展示了Configuration.getEvaluationListeners()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getEvaluationListeners()
方法的具体详情如下:
包路径:com.jayway.jsonpath.Configuration
类名称:Configuration
方法名:getEvaluationListeners
[英]Returns the evaluation listeners registered in this configuration
[中]返回在此配置中注册的求值侦听器
代码示例来源:origin: json-path/JsonPath
public void addResult(String path, PathRef operation, Object model) {
if(forUpdate) {
updateOperations.add(operation);
}
configuration.jsonProvider().setArrayIndex(valueResult, resultIndex, model);
configuration.jsonProvider().setArrayIndex(pathResult, resultIndex, path);
resultIndex++;
if(!configuration().getEvaluationListeners().isEmpty()){
int idx = resultIndex - 1;
for (EvaluationListener listener : configuration().getEvaluationListeners()) {
EvaluationListener.EvaluationContinuation continuation = listener.resultFound(new FoundResultImpl(idx, path, model));
if(EvaluationListener.EvaluationContinuation.ABORT == continuation){
throw ABORT_EVALUATION;
}
}
}
}
代码示例来源:origin: json-path/JsonPath
@Test
public void evaluation_listeners_can_be_cleared() {
EvaluationListener listener = new EvaluationListener() {
@Override
public EvaluationContinuation resultFound(FoundResult found) {
return EvaluationContinuation.CONTINUE;
}
};
Configuration configuration1 = Configuration.builder().evaluationListener(listener).build();
Configuration configuration2 = configuration1.setEvaluationListeners();
assertThat(configuration1.getEvaluationListeners()).hasSize(1);
assertThat(configuration2.getEvaluationListeners()).hasSize(0);
}
}
代码示例来源:origin: com.jayway.jsonpath/json-path
public void addResult(String path, PathRef operation, Object model) {
if(forUpdate) {
updateOperations.add(operation);
}
configuration.jsonProvider().setArrayIndex(valueResult, resultIndex, model);
configuration.jsonProvider().setArrayIndex(pathResult, resultIndex, path);
resultIndex++;
if(!configuration().getEvaluationListeners().isEmpty()){
int idx = resultIndex - 1;
for (EvaluationListener listener : configuration().getEvaluationListeners()) {
EvaluationListener.EvaluationContinuation continuation = listener.resultFound(new FoundResultImpl(idx, path, model));
if(EvaluationListener.EvaluationContinuation.ABORT == continuation){
throw ABORT_EVALUATION;
}
}
}
}
代码示例来源:origin: com.github.lafa.jsonpath/json-path
public void addResult(String path, PathRef operation, Object model) {
if(forUpdate) {
updateOperations.add(operation);
}
configuration.jsonProvider().setArrayIndex(valueResult, resultIndex, model);
configuration.jsonProvider().setArrayIndex(pathResult, resultIndex, path);
resultIndex++;
if(!configuration().getEvaluationListeners().isEmpty()){
int idx = resultIndex - 1;
for (EvaluationListener listener : configuration().getEvaluationListeners()) {
EvaluationListener.EvaluationContinuation continuation = listener.resultFound(new FoundResultImpl(idx, path, model));
if(EvaluationListener.EvaluationContinuation.ABORT == continuation){
throw ABORT_EVALUATION;
}
}
}
}
代码示例来源:origin: batfish/batfish
public JsonPathTest() {
Configuration.setDefaults(BatfishJsonPathDefaults.INSTANCE);
ConfigurationBuilder b = new ConfigurationBuilder();
_baseConfiguration = b.build();
_oneNtpServerNodesAnswerStr =
CommonUtil.readResource("org/batfish/question/jsonpath/oneNtpServer.json");
_oneNtpServerNodesAnswerJsonObject =
JsonPath.parse(_oneNtpServerNodesAnswerStr, _baseConfiguration).json();
_twoNtpServersNodesAnswerStr =
CommonUtil.readResource("org/batfish/question/jsonpath/twoNtpServers.json");
_twoNtpServersNodesAnswerJsonObject =
JsonPath.parse(_twoNtpServersNodesAnswerStr, _baseConfiguration).json();
ConfigurationBuilder prefixCb = new ConfigurationBuilder();
prefixCb.mappingProvider(_baseConfiguration.mappingProvider());
prefixCb.jsonProvider(_baseConfiguration.jsonProvider());
prefixCb.evaluationListener(_baseConfiguration.getEvaluationListeners());
prefixCb.options(_baseConfiguration.getOptions());
prefixCb.options(Option.ALWAYS_RETURN_LIST);
prefixCb.options(Option.AS_PATH_LIST);
_prefixConfiguration = prefixCb.build();
}
内容来源于网络,如有侵权,请联系作者删除!