move private method to end
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@999539 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bbdc0722a8
commit
4a6bde09a6
|
@ -169,22 +169,6 @@ public class AnnotationUtils {
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
//besides modularity, this has the advantage of autoboxing primitives:
|
|
||||||
private static int hashMember(String name, Object value) throws IllegalArgumentException,
|
|
||||||
IllegalAccessException, InvocationTargetException {
|
|
||||||
int part1 = name.hashCode() * 127;
|
|
||||||
if (value == null) {
|
|
||||||
return part1;
|
|
||||||
}
|
|
||||||
if (value.getClass().isArray()) {
|
|
||||||
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
|
|
||||||
}
|
|
||||||
if (value instanceof Annotation) {
|
|
||||||
return part1 ^ hashCode((Annotation) value);
|
|
||||||
}
|
|
||||||
return part1 ^ value.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Learn whether the specified type is permitted as an annotation member.
|
* Learn whether the specified type is permitted as an annotation member.
|
||||||
* These include {@link String}, {@link Class}, primitive types,
|
* These include {@link String}, {@link Class}, primitive types,
|
||||||
|
@ -203,6 +187,22 @@ public class AnnotationUtils {
|
||||||
|| String.class.equals(type) || Class.class.equals(type);
|
|| String.class.equals(type) || Class.class.equals(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//besides modularity, this has the advantage of autoboxing primitives:
|
||||||
|
private static int hashMember(String name, Object value) throws IllegalArgumentException,
|
||||||
|
IllegalAccessException, InvocationTargetException {
|
||||||
|
int part1 = name.hashCode() * 127;
|
||||||
|
if (value == null) {
|
||||||
|
return part1;
|
||||||
|
}
|
||||||
|
if (value.getClass().isArray()) {
|
||||||
|
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
|
||||||
|
}
|
||||||
|
if (value instanceof Annotation) {
|
||||||
|
return part1 ^ hashCode((Annotation) value);
|
||||||
|
}
|
||||||
|
return part1 ^ value.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean memberEquals(Class<?> type, Object o1, Object o2) {
|
private static boolean memberEquals(Class<?> type, Object o1, Object o2) {
|
||||||
if (o1 == o2) {
|
if (o1 == o2) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue