private boolean memberEquals()

in bval-jsr/src/main/java/org/apache/bval/jsr/util/AnnotationProxy.java [128:167]


    private boolean memberEquals(Annotation other, String name, Object value) {
        final Method member = Reflection.getDeclaredMethod(annotationType, name);
        final Object otherValue;
        try {
            otherValue = member.invoke(other);
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            throw new IllegalStateException(e);
        }
        Exceptions.raiseIf(otherValue == null || !otherValue.getClass().equals(value.getClass()),
            IllegalStateException::new, "Unexpected value %s for member %s of %s", otherValue, name, other);

        if (value instanceof Object[]) {
            return Arrays.equals((Object[]) value, (Object[]) otherValue);
        }
        if (value instanceof byte[]) {
            return Arrays.equals((byte[]) value, (byte[]) otherValue);
        }
        if (value instanceof short[]) {
            return Arrays.equals((short[]) value, (short[]) otherValue);
        }
        if (value instanceof int[]) {
            return Arrays.equals((int[]) value, (int[]) otherValue);
        }
        if (value instanceof char[]) {
            return Arrays.equals((char[]) value, (char[]) otherValue);
        }
        if (value instanceof long[]) {
            return Arrays.equals((long[]) value, (long[]) otherValue);
        }
        if (value instanceof float[]) {
            return Arrays.equals((float[]) value, (float[]) otherValue);
        }
        if (value instanceof double[]) {
            return Arrays.equals((double[]) value, (double[]) otherValue);
        }
        if (value instanceof boolean[]) {
            return Arrays.equals((boolean[]) value, (boolean[]) otherValue);
        }
        return value.equals(otherValue);
    }