use of org.cactoos.func.FuncOf in project wring by yegor256.
the class Cycle method exec.
@Override
public void exec(final Pipe pipe) throws Exception {
final XePrint print = new XePrint(pipe.asXembly());
final Events events = this.base.user(print.text("{/pipe/urn/text()}")).events();
final String json = print.text("{/pipe/json/text()}");
new UncheckedFunc<>(new FuncWithFallback<String, JsonObject>(str -> Json.createReader(new ReaderOf(str)).readObject(), new FuncOf<>(error -> events.post(Cycle.class.getCanonicalName(), String.format("Failed to parse JSON:\n%s\n\n%s", json, new TextOf(new BytesOf(error)).asString()))), obj -> {
if (obj != null) {
new Exec(new JsonAgent(this.base, obj), new IgnoreEvents(new BoostEvents(events, obj), obj), pipe).run();
}
return obj;
})).apply(json);
}
Aggregations