I was able to add a sample expression function by writing this class:
public class HelloFunction extends AbstractFunction {
public HelloFunction() {
}
@Override
public QualifiedValue execute(Expression[] args) throws ExpressionException {
return new BasicQualifiedValue(String.format("Hello World %d", args.length));
}
@Override
public String getArgDocString() {
return "int";
}
@Override
public Class<?> getType() {
return String.class;
}
@Override
protected String getFunctionDisplayName() {
return "helloWorld";
}
}
And adding this to my Designer hook:
@Override
public void configureFunctionFactory(ExpressionFunctionManager factory) {
factory.getCategories().add("Extended");
factory.addFunction("helloWorld", "Extended", new HelloFunction());
super.configureFunctionFactory(factory);
}
However, no amount of SDK and forum scouring will turn up the method for getting the argument passed in through expression.
I’m assuming it’s simple, that I am extending the wrong function class or misreading the Expression class, but how do I get the args?