protected void checkAttribute(String attributeName) {

        for (Attribute attribute : attributeList) {
            if (attribute.getName().equals(attributeName)) {
                throw new DuplicateAttributeException("'" + attributeName + "' is already defined for with type '" +
                        attribute.getType() + "' for '" + id + "'; " + this.toString(),
                        attribute.getQueryContextStartIndex(), attribute.getQueryContextEndIndex());
            }
        }
    }
Abstract definition used for Streams, Tables and other common artifacts
modules/siddhi-query-api/src/main/java/io/siddhi/query/api/definition/AbstractDefinition.java