public boolean equals()

in deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/metadata/AnnotationInstanceProvider.java [206:260]


    public boolean equals(Object o)
    {
        if (this == o)
        {
            return true;
        }
        if (!(o instanceof AnnotationInstanceProvider))
        {
            if (annotationClass.isInstance(o))
            {
                for (Map.Entry<String, ?> entry : memberValues.entrySet())
                {
                    try
                    {
                        Object oValue = annotationClass.getMethod(entry.getKey(), EMPTY_CLASS_ARRAY)
                                .invoke(o, EMPTY_OBJECT_ARRAY);
                        if (oValue != null && entry.getValue() != null)
                        {
                            if (!oValue.equals(entry.getValue()))
                            {
                                return false;
                            }
                        }
                        else // This may not actually ever happen, unless null is a default for a member
                        {
                            return false;
                        }
                    }
                    catch (IllegalAccessException e)
                    {
                        throw new RuntimeException(e);
                    }
                    catch (InvocationTargetException e)
                    {
                        throw new RuntimeException(e);
                    }
                    catch (NoSuchMethodException e)
                    {
                        throw new RuntimeException(e);
                    }
                }
                return true;
            }
            return false;
        }

        AnnotationInstanceProvider that = (AnnotationInstanceProvider) o;

        if (!annotationClass.equals(that.annotationClass))
        {
            return false;
        }

        return memberValues.equals(that.memberValues);
    }