/** * Compare this attribute declaration with another. * * @param other Another {@link XMLAttribute} to compare this {@link XMLAttribute} to. * @return A negative integer, zero or a positive integer if this object is less than, equal to or * greater than the object <code>other</code> respectively. */ public int compareTo(XMLAttribute other) { if (other == null) { throw new NullPointerException(); } // For field comparisons int fieldCompare; // Compare names fieldCompare = Utils.compare(name, other.getName()); if (fieldCompare != 0) { return fieldCompare; } // Compare content types fieldCompare = Utils.compare(attributeType, other.getType()); if (fieldCompare != 0) { return fieldCompare; } // Compare defaultDeclTypes return Utils.compare(defaultDeclType, other.getDefaultDeclType()); }