@Test public void testEmtpy() { Function param = ff.function("parameter"); try { param.evaluate(null); fail("This should have failed with an illegal argument exception"); } catch(IllegalArgumentException e) { } }
public Object evaluate(Object object) { if (parameters.size() < 1) { throw new IllegalArgumentException("The parameter function requires at " + "least one parameter, the argument name"); } String name = parameters.get(0).evaluate(object, String.class); if (name == null) { throw new IllegalArgumentException("The first function parameter should be a string, " + "the name of a process argument"); } Object value; if (parameters.size() == 1) { value = object; } else if (parameters.size() == 2) { value = parameters.get(1).evaluate(object); } else { List<Object> values = new ArrayList<Object>(); for (int i = 1; i < parameters.size(); i++) { Object o = parameters.get(i).evaluate(object); values.add(o); } value = values; } return Collections.singletonMap(name, value); }
ParameterFunction implements Function { public Object evaluate(Object object) { if (parameters.size() < 1) { throw new IllegalArgumentException("The parameter function requires at " + "least one parameter, the argument name"); } String name = parameters.get(0).evaluate(object, String.class); if (name == null) { throw new IllegalArgumentException("The first function parameter should be a string, " + "the name of a process argument"); } Object value; if (parameters.size() == 1) { value = object; } else if (parameters.size() == 2) { value = parameters.get(1).evaluate(object); } else { List<Object> values = new ArrayList<Object>(); for (int i = 1; i < parameters.size(); i++) { Object o = parameters.get(i).evaluate(object); values.add(o); } value = values; } return Collections.singletonMap(name, value); } }
ParameterFunction implements Function { public Object evaluate(Object object) { if (parameters.size() < 1) { throw new IllegalArgumentException("The parameter function requires at " + "least one parameter, the argument name"); } String name = parameters.get(0).evaluate(object, String.class); if (name == null) { throw new IllegalArgumentException("The first function parameter should be a string, " + "the name of a process argument"); } Object value; if (parameters.size() == 1) { value = object; } else if (parameters.size() == 2) { value = parameters.get(1).evaluate(object); } else { List<Object> values = new ArrayList<Object>(); for (int i = 1; i < parameters.size(); i++) { Object o = parameters.get(i).evaluate(object); values.add(o); } value = values; } return Collections.singletonMap(name, value); } ParameterFunction(Literal fallbackValue, List<Expression> parameters); }
ParameterFunction implements Function { public Object evaluate(Object object) { if (parameters.size() < 1) { throw new IllegalArgumentException("The parameter function requires at " + "least one parameter, the argument name"); } String name = parameters.get(0).evaluate(object, String.class); if (name == null) { throw new IllegalArgumentException("The first function parameter should be a string, " + "the name of a process argument"); } Object value; if (parameters.size() == 1) { value = object; } else if (parameters.size() == 2) { value = parameters.get(1).evaluate(object); } else { List<Object> values = new ArrayList<Object>(); for (int i = 1; i < parameters.size(); i++) { Object o = parameters.get(i).evaluate(object); values.add(o); } value = values; } return Collections.singletonMap(name, value); } ParameterFunction(Literal fallbackValue, List<Expression> parameters); Literal getFallbackValue(); String getName(); FunctionName getFunctionName(); List<Expression> getParameters(); Object accept(ExpressionVisitor visitor, Object extraData); Object evaluate(Object object); T evaluate(Object object, Class<T> context); }
ParameterFunction implements Function { public Object evaluate(Object object) { if (parameters.size() < 1) { throw new IllegalArgumentException("The parameter function requires at " + "least one parameter, the argument name"); } String name = parameters.get(0).evaluate(object, String.class); if (name == null) { throw new IllegalArgumentException("The first function parameter should be a string, " + "the name of a process argument"); } Object value; if (parameters.size() == 1) { value = object; } else if (parameters.size() == 2) { value = parameters.get(1).evaluate(object); } else { List<Object> values = new ArrayList<Object>(); for (int i = 1; i < parameters.size(); i++) { Object o = parameters.get(i).evaluate(object); values.add(o); } value = values; } return Collections.singletonMap(name, value); } ParameterFunction(Literal fallbackValue, List<Expression> parameters); Literal getFallbackValue(); String getName(); FunctionName getFunctionName(); List<Expression> getParameters(); Object accept(ExpressionVisitor visitor, Object extraData); Object evaluate(Object object); T evaluate(Object object, Class<T> context);  }