public boolean canConvert(Class<?> sourceType, Class<?> targetType) { if (conversionService.canConvert(sourceType, targetType)) { return true; } if (!String.class.isAssignableFrom(sourceType) && !String.class.isAssignableFrom(targetType)) { // PropertyEditor cannot convert non-Strings return false; } if (!String.class.isAssignableFrom(sourceType)) { return delegate.findCustomEditor(sourceType, null) != null || delegate.getDefaultEditor(sourceType) != null; } return delegate.findCustomEditor(targetType, null) != null || delegate.getDefaultEditor(targetType) != null; }
private PropertyEditor getPropertyEditor(Class<?> type) { SimpleTypeConverter typeConverter = this.typeConverter; if (type == null || type == Object.class || Collection.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type)) { return null; } PropertyEditor editor = typeConverter.getDefaultEditor(type); if (editor == null) { editor = typeConverter.findCustomEditor(type, null); } if (editor == null && String.class != type) { editor = BeanUtils.findEditorByConvention(type); } if (editor == null || EXCLUDED_EDITORS.contains(editor.getClass())) { return null; } return editor; }
@Override public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) { if (targetType.getType() == Void.class || targetType.getType() == Void.TYPE) { return null; } if (conversionService.canConvert(sourceType, targetType)) { return conversionService.convert(value, sourceType, targetType); } if (!String.class.isAssignableFrom(sourceType.getType())) { PropertyEditor editor = delegate.findCustomEditor(sourceType.getType(), null); editor.setValue(value); return editor.getAsText(); } return delegate.convertIfNecessary(value, targetType.getType()); }
public boolean canConvert(Class<?> sourceType, Class<?> targetType) { if (this.conversionService.canConvert(sourceType, targetType)) { return true; } if (!String.class.isAssignableFrom(sourceType) && !String.class.isAssignableFrom(targetType)) { // PropertyEditor cannot convert non-Strings return false; } if (!String.class.isAssignableFrom(sourceType)) { return this.delegate.findCustomEditor(sourceType, null) != null || this.getDefaultEditor(sourceType) != null; } return this.delegate.findCustomEditor(targetType, null) != null || this.getDefaultEditor(targetType) != null; }
@Override public boolean supports(ParamMetaData metaData) { if (ClassUtils.isPrimitiveOrWrapper(metaData.getParamType())) { return true; } SimpleTypeConverter simpleTypeConverter = SafedTypeConverterFactory .getCurrentConverter(); return simpleTypeConverter.findCustomEditor(metaData.getParamType(), null) != null || simpleTypeConverter.getDefaultEditor(metaData.getParamType()) != null; }
PropertyEditor editor = this.delegate.findCustomEditor(sourceType.getType(), null); if (editor == null) { editor = this.getDefaultEditor(sourceType.getType());
public boolean canConvert(Class<?> sourceType, Class<?> targetType) { if (this.conversionService.canConvert(sourceType, targetType)) { return true; } if (!String.class.isAssignableFrom(sourceType) && !String.class.isAssignableFrom(targetType)) { // PropertyEditor cannot convert non-Strings return false; } if (!String.class.isAssignableFrom(sourceType)) { return this.delegate.findCustomEditor(sourceType, null) != null || this.getDefaultEditor(sourceType) != null; } return this.delegate.findCustomEditor(targetType, null) != null || this.getDefaultEditor(targetType) != null; }
public boolean canConvert(Class<?> sourceType, Class<?> targetType) { if (conversionService.canConvert(sourceType, targetType)) { return true; } if (!String.class.isAssignableFrom(sourceType) && !String.class.isAssignableFrom(targetType)) { // PropertyEditor cannot convert non-Strings return false; } if (!String.class.isAssignableFrom(sourceType)) { return delegate.findCustomEditor(sourceType, null) != null || this.getDefaultEditor(sourceType) != null; } return delegate.findCustomEditor(targetType, null) != null || this.getDefaultEditor(targetType) != null; }
public boolean canConvert(Class<?> sourceType, Class<?> targetType) { if (conversionService.canConvert(sourceType, targetType)) { return true; } if (!String.class.isAssignableFrom(sourceType) && !String.class.isAssignableFrom(targetType)) { // PropertyEditor cannot convert non-Strings return false; } if (!String.class.isAssignableFrom(sourceType)) { return delegate.findCustomEditor(sourceType, null) != null || this.getDefaultEditor(sourceType) != null; } return delegate.findCustomEditor(targetType, null) != null || this.getDefaultEditor(targetType) != null; }
@Override public boolean supports(ParamMetaData metaData) { if (ClassUtils.isPrimitiveOrWrapper(metaData.getParamType())) { return true; } SimpleTypeConverter simpleTypeConverter = SafedTypeConverterFactory .getCurrentConverter(); return simpleTypeConverter.findCustomEditor(metaData.getParamType(), null) != null || simpleTypeConverter.getDefaultEditor(metaData.getParamType()) != null; }
PropertyEditor editor = delegate.findCustomEditor(sourceType.getType(), null); if (editor == null) { editor = this.getDefaultEditor(sourceType.getType());
PropertyEditor editor = delegate.findCustomEditor(sourceType.getType(), null); if (editor == null) { editor = this.getDefaultEditor(sourceType.getType());
PropertyEditor editor = this.delegate.findCustomEditor(sourceType.getType(), null); if (editor == null) { editor = this.getDefaultEditor(sourceType.getType());