Class Comparer


  • class Comparer
    extends java.lang.Object
    The Comparer is used to compare annotations on the attributes of that annotation. Unlike the equals method, this can ignore some attributes based on the name of the attributes. This is useful if some annotations have overridden values, such as the field or method name.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String[] ignore
      This is the list of names to ignore for this instance.
      private static java.lang.String NAME
      This is the default attribute to ignore for the comparer.
    • Constructor Summary

      Constructors 
      Constructor Description
      Comparer()
      Constructor for the Comparer object.
      Comparer​(java.lang.String... ignore)
      Constructor for the Comparer object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.annotation.Annotation left, java.lang.annotation.Annotation right)
      This is used to determine if two annotations are equals based on the attributes of the annotation.
      private boolean isIgnore​(java.lang.reflect.Method method)
      This is used to determine if the method for an attribute is to be ignore.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NAME

        private static final java.lang.String NAME
        This is the default attribute to ignore for the comparer.
        See Also:
        Constant Field Values
      • ignore

        private final java.lang.String[] ignore
        This is the list of names to ignore for this instance.
    • Constructor Detail

      • Comparer

        public Comparer()
        Constructor for the Comparer object. This is used to create a comparer that has a default set of names to be ignored during the comparison of annotations.
      • Comparer

        public Comparer​(java.lang.String... ignore)
        Constructor for the Comparer object. This is used to create a comparer that has a default set of names to be ignored during the comparison of annotations.
        Parameters:
        ignore - this is the set of attributes to be ignored
    • Method Detail

      • equals

        public boolean equals​(java.lang.annotation.Annotation left,
                              java.lang.annotation.Annotation right)
                       throws java.lang.Exception
        This is used to determine if two annotations are equals based on the attributes of the annotation. The comparison done can ignore specific attributes, for instance the name attribute.
        Parameters:
        left - this is the left side of the comparison done
        right - this is the right side of the comparison done
        Returns:
        this returns true if the annotations are equal
        Throws:
        java.lang.Exception
      • isIgnore

        private boolean isIgnore​(java.lang.reflect.Method method)
        This is used to determine if the method for an attribute is to be ignore. To determine if it should be ignore the method name is compared against the list of attributes to ignore.
        Parameters:
        method - this is the method to be evaluated
        Returns:
        this returns true if the method should be ignored