private static PropertyEditor findEditor ( final Type type ) { assert type != null ; Class clazz = toClass ( type ) ; // try to locate this directly from the editor manager first. PropertyEditor editor = PropertyEditorManager . findEditor ( clazz ) ; // we're outta here if we got one. if ( editor != null ) { return editor ; } // it's possible this was a request for an array class. We might not // recognize the array type directly, but the component type might be // resolvable if ( clazz . isArray ( ) && ! clazz . getComponentType ( ) . isArray ( ) ) { // do a recursive lookup on the base type editor = findEditor ( clazz . getComponentType ( ) ) ; // if we found a suitable editor for the base component type, // wrapper this in an array adaptor for real use if ( editor != null ) { return new ArrayConverter ( clazz , editor ) ; } } // nothing found return null ; }
Locate a property editor for given class of object .