@Override
    protected Object execute(Object[] data, State state) {
        if (returnType == Attribute.Type.DOUBLE) {
            double total = 0;
            for (Object aObj : data) {
                total += Double.parseDouble(String.valueOf(aObj));
            }

            return total;
        } else {
            long total = 0;
            for (Object aObj : data) {
                total += Long.parseLong(String.valueOf(aObj));
            }
            return total;
        }
    }
The main execution method which will be called upon event arrival
when there are more then one function parameter

@param data  the runtime values of function parameters
@param state
@return the function result
modules/siddhi-samples/quick-start-samples/src/main/java/io/siddhi/sample/util/CustomFunctionExtension.java