List of usage examples for org.springframework.beans PropertyEditorRegistrySupport getDefaultEditor
@Nullable
public PropertyEditor getDefaultEditor(Class<?> requiredType)
From source file:org.springframework.faces.mvc.bind.ReverseDataBinder.java
/** * Find a default editor for the given type. This code is based on <tt>TypeConverterDelegate.findDefaultEditor</tt> * from Spring 2.5.6./*from www. j a va 2 s .c o m*/ * @param requiredType the type to find an editor for * @param descriptor the JavaBeans descriptor for the property * @return the corresponding editor, or <code>null</code> if none * * @author Juergen Hoeller * @author Rob Harrop */ protected PropertyEditor findDefaultEditor(PropertyEditorRegistrySupport propertyEditorRegistrySupport, Object targetObject, Class requiredType, PropertyDescriptor descriptor) { PropertyEditor editor = null; if (descriptor != null) { if (JdkVersion.isAtLeastJava15()) { editor = descriptor.createPropertyEditor(targetObject); } else { Class editorClass = descriptor.getPropertyEditorClass(); if (editorClass != null) { editor = (PropertyEditor) BeanUtils.instantiateClass(editorClass); } } } if (editor == null && requiredType != null) { // No custom editor -> check default editors. editor = propertyEditorRegistrySupport.getDefaultEditor(requiredType); if (editor == null && !String.class.equals(requiredType)) { // No BeanWrapper default editor -> check standard JavaBean editor. editor = BeanUtils.findEditorByConvention(requiredType); if (editor == null && !unknownEditorTypes.containsKey(requiredType)) { // Global PropertyEditorManager fallback... editor = PropertyEditorManager.findEditor(requiredType); if (editor == null) { // Regular case as of Spring 2.5 unknownEditorTypes.put(requiredType, Boolean.TRUE); } } } } return editor; }
From source file:org.springframework.springfaces.mvc.bind.ReverseDataBinder.java
/** * Find a default editor for the given type. This code is based on <tt>TypeConverterDelegate.findDefaultEditor</tt>. * @param requiredType the type to find an editor for * @param typeDescriptor the type description of the property * @return the corresponding editor, or <code>null</code> if none * /*w w w.j a v a 2 s . c o m*/ * @param propertyEditorRegistry * @param targetObject * * @author Juergen Hoeller * @author Rob Harrop */ protected PropertyEditor findDefaultEditor(PropertyEditorRegistrySupport propertyEditorRegistry, Object targetObject, Class<?> requiredType, TypeDescriptor typeDescriptor) { PropertyEditor editor = null; if (requiredType != null) { // No custom editor -> check BeanWrapperImpl's default editors. editor = propertyEditorRegistry.getDefaultEditor(requiredType); if (editor == null && !String.class.equals(requiredType)) { // No BeanWrapper default editor -> check standard JavaBean editor. editor = BeanUtils.findEditorByConvention(requiredType); } } return editor; }