|
|
@ -500,13 +500,17 @@ public class GenericConversionService implements ConfigurableConversionService { |
|
|
|
return Collections.singleton(this.typeInfo); |
|
|
|
return Collections.singleton(this.typeInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean matchesTargetType(TypeDescriptor targetType) { |
|
|
|
|
|
|
|
return this.typeInfo.getTargetType().equals(targetType.getObjectType()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { |
|
|
|
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { |
|
|
|
if (source == null) { |
|
|
|
if (source == null) { |
|
|
|
return convertNullSource(sourceType, targetType); |
|
|
|
return convertNullSource(sourceType, targetType); |
|
|
|
} |
|
|
|
} |
|
|
|
return this.converter.convert(source); |
|
|
|
return this.converter.convert(source); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String toString() { |
|
|
|
public String toString() { |
|
|
|
return this.typeInfo.getSourceType().getName() + " -> " + this.typeInfo.getTargetType().getName() + |
|
|
|
return this.typeInfo.getSourceType().getName() + " -> " + this.typeInfo.getTargetType().getName() + |
|
|
|
" : " + this.converter.toString(); |
|
|
|
" : " + this.converter.toString(); |
|
|
@ -571,6 +575,12 @@ public class GenericConversionService implements ConfigurableConversionService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.defaultConverter instanceof ConverterAdapter) { |
|
|
|
|
|
|
|
ConverterAdapter adapter = (ConverterAdapter) this.defaultConverter; |
|
|
|
|
|
|
|
if (!adapter.matchesTargetType(targetType)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return this.defaultConverter; |
|
|
|
return this.defaultConverter; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|