Class Comparer

java.lang.Object
org.simpleframework.xml.core.Comparer

class Comparer extends 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 final String[]
    This is the list of names to ignore for this instance.
    private static final String
    This is the default attribute to ignore for the comparer.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    boolean
    This is used to determine if two annotations are equals based on the attributes of the annotation.
    private boolean
    isIgnore(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 Details

    • NAME

      private static final String NAME
      This is the default attribute to ignore for the comparer.
      See Also:
    • ignore

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

    • 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(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 Details

    • equals

      public boolean equals(Annotation left, Annotation right) throws 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:
      Exception
    • isIgnore

      private boolean isIgnore(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