Java Code Examples for org.springframework.beans.BeanUtils#findEditorByConvention()

The following examples show how to use org.springframework.beans.BeanUtils#findEditorByConvention() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BindConverter.java    From spring-cloud-gray with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: AbstractPropertyBindingResult.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Retrieve the custom PropertyEditor for the given field, if any.
 * @param fixedField the fully qualified field name
 * @return the custom PropertyEditor, or {@code null}
 */
@Nullable
protected PropertyEditor getCustomEditor(String fixedField) {
	Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField);
	PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField);
	if (editor == null) {
		editor = BeanUtils.findEditorByConvention(targetType);
	}
	return editor;
}
 
Example 3
Source File: AbstractPropertyBindingResult.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Retrieve the custom PropertyEditor for the given field, if any.
 * @param fixedField the fully qualified field name
 * @return the custom PropertyEditor, or {@code null}
 */
@Nullable
protected PropertyEditor getCustomEditor(String fixedField) {
	Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField);
	PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField);
	if (editor == null) {
		editor = BeanUtils.findEditorByConvention(targetType);
	}
	return editor;
}
 
Example 4
Source File: AbstractPropertyBindingResult.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retrieve the custom PropertyEditor for the given field, if any.
 * @param fixedField the fully qualified field name
 * @return the custom PropertyEditor, or {@code null}
 */
protected PropertyEditor getCustomEditor(String fixedField) {
	Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField);
	PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField);
	if (editor == null) {
		editor = BeanUtils.findEditorByConvention(targetType);
	}
	return editor;
}
 
Example 5
Source File: AbstractPropertyBindingResult.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieve the custom PropertyEditor for the given field, if any.
 * @param fixedField the fully qualified field name
 * @return the custom PropertyEditor, or {@code null}
 */
protected PropertyEditor getCustomEditor(String fixedField) {
	Class<?> targetType = getPropertyAccessor().getPropertyType(fixedField);
	PropertyEditor editor = getPropertyAccessor().findCustomEditor(targetType, fixedField);
	if (editor == null) {
		editor = BeanUtils.findEditorByConvention(targetType);
	}
	return editor;
}