checking in performance tests

This commit is contained in:
Keith Donald
2010-04-19 20:22:01 +00:00
parent 6e13cc9eaa
commit 86906d1b4d
4 changed files with 19 additions and 19 deletions

View File

@@ -400,6 +400,9 @@ public class TypeDescriptor {
return false;
}
TypeDescriptor td = (TypeDescriptor) obj;
if (this == td) {
return true;
}
boolean annotatedTypeEquals = getType().equals(td.getType()) && ObjectUtils.nullSafeEquals(getAnnotations(), td.getAnnotations());
if (isCollection()) {
return annotatedTypeEquals && ObjectUtils.nullSafeEquals(getElementType(), td.getElementType());
@@ -411,14 +414,7 @@ public class TypeDescriptor {
}
public int hashCode() {
int annotatedTypeHash = getType().hashCode() + ObjectUtils.nullSafeHashCode(getAnnotations());
if (isCollection()) {
return annotatedTypeHash + ObjectUtils.nullSafeHashCode(getElementType());
} else if (isMap()) {
return annotatedTypeHash + ObjectUtils.nullSafeHashCode(getMapKeyType()) + ObjectUtils.nullSafeHashCode(getMapValueType());
} else {
return annotatedTypeHash;
}
return getType().hashCode();
}
/**

View File

@@ -64,6 +64,9 @@ public class GenericConversionService implements ConversionService, ConverterReg
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
return source;
}
public String toString() {
return "NO_OP";
}
};
private static final GenericConverter NO_MATCH = new GenericConverter() {
@@ -396,7 +399,6 @@ public class GenericConversionService implements ConversionService, ConverterReg
private GenericConverter getMatchingConverterForTarget(TypeDescriptor sourceType, TypeDescriptor targetType,
Map<Class<?>, MatchableConverters> converters) {
Class<?> targetObjectType = targetType.getObjectType();
if (targetObjectType.isInterface()) {
LinkedList<Class<?>> classQueue = new LinkedList<Class<?>>();
@@ -594,11 +596,11 @@ public class GenericConversionService implements ConversionService, ConverterReg
}
}
private static class ConverterCacheKey {
private static final class ConverterCacheKey {
private TypeDescriptor sourceType;
private final TypeDescriptor sourceType;
private TypeDescriptor targetType;
private final TypeDescriptor targetType;
public ConverterCacheKey(TypeDescriptor sourceType, TypeDescriptor targetType) {
this.sourceType = sourceType;
@@ -614,7 +616,7 @@ public class GenericConversionService implements ConversionService, ConverterReg
}
public int hashCode() {
return sourceType.hashCode() + targetType.hashCode();
return sourceType.hashCode() * 29 + targetType.hashCode();
}
public String toString() {