@Test public void shouldCallFunction() { final IJsonNode result = FunctionUtil.createFunctionCall( FunctionCallTest.class, "sum", new ArrayAccess(0), new ArrayAccess(1)). evaluate(createArrayNode(1, 2)); Assert.assertEquals(new DoubleNode(3), result); }
@Override public IJsonNode evaluate(final IJsonNode node) { final List<EvaluationExpression> paramExprs = this.paramExprs; this.params.clear(); for (int index = 0; index < paramExprs.size(); index++) this.params.add(paramExprs.get(index).evaluate(node)); try { return this.function.call(this.params); } catch (final Exception e) { throw new EvaluationException(e); } }
FunctionCall extends EvaluationExpression { @Override public IJsonNode evaluate(final IJsonNode node) { final List<EvaluationExpression> paramExprs = this.paramExprs; this.params.clear(); for (int index = 0; index < paramExprs.size(); index++) this.params.add(paramExprs.get(index).evaluate(node)); try { return this.function.call(this.params); } catch (final Exception e) { throw new EvaluationException(e); } } }
FunctionCall extends EvaluationExpression { @Override public IJsonNode evaluate(final IJsonNode node) { final List<EvaluationExpression> paramExprs = this.paramExprs; this.params.clear(); for (int index = 0; index < paramExprs.size(); index++) this.params.add(paramExprs.get(index).evaluate(node)); try { return this.function.call(this.params); } catch (final Exception e) { throw new EvaluationException(e); } } FunctionCall(final SopremoFunction function, final EvaluationExpression... params);  FunctionCall(final SopremoFunction function, final List<EvaluationExpression> params);   FunctionCall(); }
FunctionCall extends EvaluationExpression { @Override public IJsonNode evaluate(final IJsonNode node) { final List<EvaluationExpression> paramExprs = this.paramExprs; this.params.clear(); for (int index = 0; index < paramExprs.size(); index++) this.params.add(paramExprs.get(index).evaluate(node)); try { return this.function.call(this.params); } catch (final Exception e) { throw new EvaluationException(e); } } FunctionCall(final SopremoFunction function, final EvaluationExpression... params);  FunctionCall(final SopremoFunction function, final List<EvaluationExpression> params);   FunctionCall(); @Override void appendAsString(final Appendable appendable); @Override boolean equals(final Object obj); @Override IJsonNode evaluate(final IJsonNode node); SopremoFunction getFunction(); List<EvaluationExpression> getParameters(); @Override int hashCode(); @Override ChildIterator iterator(); }
FunctionCall extends EvaluationExpression { @Override public IJsonNode evaluate(final IJsonNode node) { final List<EvaluationExpression> paramExprs = this.paramExprs; this.params.clear(); for (int index = 0; index < paramExprs.size(); index++) this.params.add(paramExprs.get(index).evaluate(node)); try { return this.function.call(this.params); } catch (final Exception e) { throw new EvaluationException(e); } } FunctionCall(final SopremoFunction function, final EvaluationExpression... params);  FunctionCall(final SopremoFunction function, final List<EvaluationExpression> params);   FunctionCall(); @Override void appendAsString(final Appendable appendable); @Override boolean equals(final Object obj); @Override IJsonNode evaluate(final IJsonNode node); SopremoFunction getFunction(); List<EvaluationExpression> getParameters(); @Override int hashCode(); @Override ChildIterator iterator();  }