/** * Compares two annotated elements to see if they have the same annotations * */ private static boolean compareAnnotatedParameters(List<? extends AnnotatedParameter<?>> p1, List<? extends AnnotatedParameter<?>> p2) { if (p1.size() != p2.size()) { return false; } for (int i = 0; i < p1.size(); ++i) { if (!compareAnnotated(p1.get(i), p2.get(i))) { return false; } } return true; }
/** * <p> * Compare {@link AnnotatedCallable}s for equality. * </p> * * <p> * Two {@link AnnotatedCallable}s are considered equal if they have the same * underlying callable and annotations. * </p> */ public static boolean compareAnnotatedCallable(AnnotatedCallable<?> m1, AnnotatedCallable<?> m2) { if (!m1.getJavaMember().equals(m2.getJavaMember())) { return false; } if (!compareAnnotated(m1, m2)) { return false; } return compareAnnotatedParameters(m1.getParameters(), m2.getParameters()); }
/** * <p> * Compares {@link AnnotatedField}s for equality. * </p> * <p> * Two {@link AnnotatedField}s are considered equal if they have the same * underlying field and annotations. * </p> */ public static boolean compareAnnotatedField(AnnotatedField<?> f1, AnnotatedField<?> f2) { if (!f1.getJavaMember().equals(f2.getJavaMember())) { return false; } return compareAnnotated(f1, f2); }