Skip to content

Instantly share code, notes, and snippets.

@amolbrid
Last active November 18, 2016 18:16
Show Gist options
  • Save amolbrid/ee2fde0c2c63dbdc44f59ddc5bb6c35c to your computer and use it in GitHub Desktop.
Save amolbrid/ee2fde0c2c63dbdc44f59ddc5bb6c35c to your computer and use it in GitHub Desktop.
ArrayCompose with constant
String json = "{\"name\":\"abc\", \"active\":false}";
StartFunction start = new StartFunction();
ConstantFunction constFun1 = new ConstantFunction(JsonNodeFactory.instance.textNode("const1"));
ConstantFunction constFun2 = new ConstantFunction(JsonNodeFactory.instance.textNode("const1"));
ReadPropertyFunction read = new ReadPropertyFunction("name");
ReadPropertyFunction readActive = new ReadPropertyFunction("active");
EqualsFunction eql = new EqualsFunction("true");
ArrayComposeFunction arrayCompose = new ArrayComposeFunction();
PrintFunction print = new PrintFunction();
start.addDependent(constFun1).addDependent(arrayCompose).addDependent(print);
start.addDependent(constFun2).addDependent(arrayCompose);
start.addDependent(readActive).addDependent(eql).addDependent(read).addDependent(arrayCompose);
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(json);
Context context = new Context(node);
ExecutorFunction function = new ExecutorFunction(start);
function.apply(context, node);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment