use of com.yahoo.slime.ObjectTraverser in project vespa by vespa-engine.
the class ConfigPayloadApplier method handleInnerMap.
private void handleInnerMap(String name, Inspector inspector) {
NamedBuilder builder = createBuilder(stack.peek(), stack.peek().peekName());
setMapLeafValue(name, builder.builder());
stack.push(builder);
inspector.traverse(new ObjectTraverser() {
@Override
public void field(String name, Inspector inspector) {
handleObjectEntry(name, inspector);
}
});
stack.pop();
}
use of com.yahoo.slime.ObjectTraverser in project vespa by vespa-engine.
the class ConfigPayloadApplier method handleOBJECT.
private void handleOBJECT(Inspector inspector) {
trace("Object");
printStack();
inspector.traverse(new ObjectTraverser() {
@Override
public void field(String name, Inspector inspector) {
handleObjectEntry(name, inspector);
}
});
trace("Should pop a builder from stack");
NamedBuilder builder = stack.pop();
printStack();
// Need to set e.g struct(Struct.Builder) here
if (!stack.empty()) {
trace("builder= " + builder);
try {
invokeSetter(stack.peek().builder, builder.peekName(), builder.builder);
} catch (Exception e) {
throw new RuntimeException("Could not set '" + builder.peekName() + "' for value '" + builder.builder() + "'", e);
}
}
}
use of com.yahoo.slime.ObjectTraverser in project vespa by vespa-engine.
the class ConfidenceOverrideSerializer method fromSlime.
public Map<Version, Confidence> fromSlime(Slime slime) {
Cursor root = slime.get();
Cursor overridesObject = root.field(overridesField);
Map<Version, Confidence> overrides = new LinkedHashMap<>();
overridesObject.traverse((ObjectTraverser) (name, value) -> {
overrides.put(Version.fromString(name), Confidence.valueOf(value.asString()));
});
return Collections.unmodifiableMap(overrides);
}
Aggregations