コード例 #1
0
 /**
  * Find a default editor for the given type.
  *
  * @param requiredType the type to find an editor for
  * @return the corresponding editor, or {@code null} if none
  */
 private PropertyEditor findDefaultEditor(Class<?> requiredType) {
   PropertyEditor editor = null;
   if (requiredType != null) {
     // No custom editor -> check BeanWrapperImpl's default editors.
     editor = this.propertyEditorRegistry.getDefaultEditor(requiredType);
     if (editor == null && String.class != requiredType) {
       // No BeanWrapper default editor -> check standard JavaBean editor.
       editor = BeanUtils.findEditorByConvention(requiredType);
     }
   }
   return editor;
 }
コード例 #2
0
 /**
  * Find a default editor for the given type.
  *
  * @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
  */
 protected PropertyEditor findDefaultEditor(Class requiredType, TypeDescriptor typeDescriptor) {
   PropertyEditor editor = null;
   if (typeDescriptor instanceof PropertyTypeDescriptor) {
     PropertyDescriptor pd = ((PropertyTypeDescriptor) typeDescriptor).getPropertyDescriptor();
     editor = pd.createPropertyEditor(this.targetObject);
   }
   if (editor == null && requiredType != null) {
     // No custom editor -> check BeanWrapperImpl's default editors.
     editor = this.propertyEditorRegistry.getDefaultEditor(requiredType);
     if (editor == null && !String.class.equals(requiredType)) {
       // No BeanWrapper default editor -> check standard JavaBean editor.
       editor = BeanUtils.findEditorByConvention(requiredType);
     }
   }
   return editor;
 }