use of com.jayway.jsonpath.spi.json.JsonProvider in project JsonPath by jayway.
the class Append method invoke.
@Override
public Object invoke(String currentPath, PathRef parent, Object model, EvaluationContext ctx, List<Parameter> parameters) {
JsonProvider jsonProvider = ctx.configuration().jsonProvider();
if (parameters != null && parameters.size() > 0) {
for (Parameter param : parameters) {
if (jsonProvider.isArray(model)) {
int len = jsonProvider.length(model);
jsonProvider.setArrayIndex(model, len, param.getCachedValue());
}
}
}
return model;
}
use of com.jayway.jsonpath.spi.json.JsonProvider in project geode by apache.
the class UseJacksonForJsonPathRule method before.
/**
* Override to set up your specific external resource.
*/
@Override
public void before() {
saveDefaults();
Configuration.setDefaults(new Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
});
}
Aggregations