@Override
    public String toString() {

        boolean isFirst = true;
        StringBuilder definitionBuilder = new StringBuilder("@").append(name).append("( ");
        if (elements != null && elements.size() > 0) {

            for (Element element : elements) {
                if (!isFirst) {
                    definitionBuilder.append(", ");
                } else {
                    isFirst = false;
                }
                definitionBuilder.append(element.toString());
            }
        }
        if (annotations != null && annotations.size() > 0) {

            for (Annotation annotation : annotations) {
                if (!isFirst) {
                    definitionBuilder.append(", ");
                } else {
                    isFirst = false;
                }
                definitionBuilder.append(annotation.toString());
            }
        }
        definitionBuilder.append(")");
        return definitionBuilder.toString();
    }
Annotation for siddhi functions and extensions
modules/siddhi-query-api/src/main/java/io/siddhi/query/api/annotation/Annotation.java