/** {@inheritDoc} */ public int compareTo(Annotation other) { int result = type.compareTo(other.type); if (result != 0) { return result; } result = visibility.compareTo(other.visibility); if (result != 0) { return result; } Iterator<NameValuePair> thisIter = elements.values().iterator(); Iterator<NameValuePair> otherIter = other.elements.values().iterator(); while (thisIter.hasNext() && otherIter.hasNext()) { NameValuePair thisOne = thisIter.next(); NameValuePair otherOne = otherIter.next(); result = thisOne.compareTo(otherOne); if (result != 0) { return result; } } if (thisIter.hasNext()) { return 1; } else if (otherIter.hasNext()) { return -1; } return 0; }
/** {@inheritDoc} */ public String toHuman() { StringBuilder sb = new StringBuilder(); sb.append(visibility.toHuman()); sb.append("-annotation "); sb.append(type.toHuman()); sb.append(" {"); boolean first = true; for (NameValuePair pair : elements.values()) { if (first) { first = false; } else { sb.append(", "); } sb.append(pair.getName().toHuman()); sb.append(": "); sb.append(pair.getValue().toHuman()); } sb.append("}"); return sb.toString(); }
/** {@inheritDoc} */ public int hashCode() { int hash = type.hashCode(); hash = (hash * 31) + elements.hashCode(); hash = (hash * 31) + visibility.hashCode(); return hash; }