public int getAttributePosition(String attributeName) {

        for (int i = 0, attributeListSize = attributeList.size(); i < attributeListSize; i++) {
            Attribute attribute = attributeList.get(i);
            if (attribute.getName().equals(attributeName)) {
                return i;
            }
        }
        throw new AttributeNotExistException("Cannot get attribute position as '" + attributeName + "' does not exist" +
                " in '" + id + "'; " + this.toString());
    }
Abstract definition used for Streams, Tables and other common artifacts
modules/siddhi-query-api/src/main/java/io/siddhi/query/api/definition/AbstractDefinition.java