@Override public int hashCode() { int h = annotationName.hashCode(); if (annotationParamValues != null) { for (int i = 0; i < annotationParamValues.size(); i++) { final AnnotationParamValue e = annotationParamValues.get(i); h = h * 7 + e.getParamName().hashCode() * 3 + e.getParamValue().hashCode(); } } return h; }
@Override public int compareTo(final AnnotationParamValue o) { final int diff = paramName.compareTo(o.getParamName()); if (diff != 0) { return diff; } // Use toString() order and get() (which can be slow) as a last-ditch effort -- only happens // if the annotation has multiple parameters of the same name but different value. final Object p0 = getParamValue(); final Object p1 = o.getParamValue(); if (p0 == null && p1 == null) { return 0; } else if (p0 == null && p1 != null) { return -1; } else if (p0 != null && p1 == null) { return 1; } return p0.toString().compareTo(p1.toString()); }