Package org.simpleframework.xml.core
Class Comparer
- java.lang.Object
-
- org.simpleframework.xml.core.Comparer
-
class Comparer extends java.lang.Object
TheComparer
is used to compare annotations on the attributes of that annotation. Unlike theequals
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.
-
-
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.
-
-
-
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 theComparer
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 theComparer
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 doneright
- 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
-
-