Errai 3.0.1-SNAPSHOT

org.jboss.errai.ioc.client
Interface AnnotationComparator<T extends Annotation>


public interface AnnotationComparator<T extends Annotation>

A simple comparator interface used by the QualifierEqualityFactory generator to create comparators for testing the equality of qualifiers at runtime.

NOTE: This interface is only for tested the attribute-equality of like-typed annotations. For instance, you can only compare an annotation of type Foo with another annotation of type Foo. You cannot compare the equality of Foo with Bar. Attempting to do so will simply result in a ClassCastException.

Author:
Mike Brock

Method Summary
 int hashCodeOf(T a1)
          Creates a consistent hashCode based on the attribute values of the annotation.
 boolean isEqual(T a1, T a2)
          Tests the equality of two qualifiers.
 

Method Detail

isEqual

boolean isEqual(T a1,
                T a2)
Tests the equality of two qualifiers. Does not accept null values.

Parameters:
a1 - an annotation to be compared. cannot be null.
a2 - an annotation to be compared. cannot be null.
Returns:
true if the annotations match.

hashCodeOf

int hashCodeOf(T a1)
Creates a consistent hashCode based on the attribute values of the annotation.

Parameters:
a1 - the annotation to have a hashCode generated for. cannot be null.
Returns:
a consistent hash code.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.