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

The following examples show how to use org.springframework.beans.BeanUtils#findEditorByConvention() . These examples are extracted from open source projects. 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 Project: spring-cloud-gray   File: BindConverter.java    License: 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
/**
 * 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
/**
 * 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
/**
 * 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
/**
 * 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;
}