Checkstyle and trailing spaces.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1083058 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ee0e27d638
commit
e8c97dc4e7
|
@ -222,6 +222,13 @@ public class AnnotationUtils {
|
|||
}
|
||||
|
||||
//besides modularity, this has the advantage of autoboxing primitives:
|
||||
/**
|
||||
* Helper method for generating a hash code for a member of an annotation.
|
||||
*
|
||||
* @param name the name of the member
|
||||
* @param the value of the member
|
||||
* @return a hash code for this member
|
||||
*/
|
||||
private static int hashMember(String name, Object value) {
|
||||
int part1 = name.hashCode() * 127;
|
||||
if (value.getClass().isArray()) {
|
||||
|
@ -233,6 +240,16 @@ public class AnnotationUtils {
|
|||
return part1 ^ value.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for checking whether two objects of the given type are
|
||||
* equal. This method is used to compare the parameters of two annotation
|
||||
* instances.
|
||||
*
|
||||
* @param type the type of the objects to be compared
|
||||
* @param o1 the first object
|
||||
* @param o2 the second object
|
||||
* @return a flag whether these objects are equal
|
||||
*/
|
||||
private static boolean memberEquals(Class<?> type, Object o1, Object o2) {
|
||||
if (o1 == o2) {
|
||||
return true;
|
||||
|
@ -249,6 +266,14 @@ public class AnnotationUtils {
|
|||
return o1.equals(o2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for comparing two objects of an array type.
|
||||
*
|
||||
* @param componentType the component type of the array
|
||||
* @param o1 the first object
|
||||
* @param o2 the second object
|
||||
* @return a flag whether these objects are equal
|
||||
*/
|
||||
private static boolean arrayMemberEquals(Class<?> componentType, Object o1, Object o2) {
|
||||
if (componentType.isAnnotation()) {
|
||||
return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2);
|
||||
|
@ -280,6 +305,13 @@ public class AnnotationUtils {
|
|||
return Arrays.equals((Object[]) o1, (Object[]) o2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for comparing two arrays of annotations.
|
||||
*
|
||||
* @param a1 the first array
|
||||
* @param a2 the second array
|
||||
* @return a flag whether these arrays are equal
|
||||
*/
|
||||
private static boolean annotationArrayMemberEquals(Annotation[] a1, Annotation[] a2) {
|
||||
if (a1.length != a2.length) {
|
||||
return false;
|
||||
|
@ -292,6 +324,13 @@ public class AnnotationUtils {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for generating a hash code for an array.
|
||||
*
|
||||
* @param componentType the component type of the array
|
||||
* @param o the array
|
||||
* @return a hash code for this array
|
||||
*/
|
||||
private static int arrayMemberHash(Class<?> componentType, Object o) {
|
||||
if (componentType.equals(Byte.TYPE)) {
|
||||
return Arrays.hashCode((byte[]) o);
|
||||
|
|
Loading…
Reference in New Issue