@Override
    protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                                SiddhiQueryContext siddhiQueryContext) {
        for (ExpressionExecutor expressionExecutor : attributeExpressionExecutors) {
            Attribute.Type attributeType = expressionExecutor.getReturnType();
            if (attributeType == Attribute.Type.DOUBLE) {
                returnType = attributeType;

            } else if ((attributeType == Attribute.Type.STRING) || (attributeType == Attribute.Type.BOOL)) {
                throw new SiddhiAppCreationException("Plus cannot have parameters with types String or Bool");
            } else {
                returnType = Attribute.Type.LONG;
            }
        }
        return null;
    }
The initialization method for FunctionExecutor, this method will be called before the other methods

@param attributeExpressionExecutors are the executors of each function parameters
@param configReader
@param siddhiQueryContext           the context of the siddhi query
modules/siddhi-samples/quick-start-samples/src/main/java/io/siddhi/sample/util/CustomFunctionExtension.java