ObjectPropertyUtils.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:rice 作者:
/**
 * Get a property editor given a property type.
 *
 * @param propertyType The property type to look up an editor for.
 * @param path The property path, if applicable.
 * @return property editor
 */
public static PropertyEditor getPropertyEditor(Class<?> propertyType) {
    PropertyEditorRegistry registry = getPropertyEditorRegistry();
    PropertyEditor editor = null;

    if (registry != null) {
        editor = registry.findCustomEditor(propertyType, null);
    } else {

        DataDictionaryService dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
        Map<Class<?>, String> editorMap = dataDictionaryService.getPropertyEditorMap();
        String editorPrototypeName = editorMap == null ? null : editorMap.get(propertyType);

        if (editorPrototypeName != null) {
            editor = (PropertyEditor) dataDictionaryService.getDataDictionary().getDictionaryPrototype(editorPrototypeName);
        }
    }

    if (editor == null && propertyType != null) {
        // Fall back to default beans lookup
        editor = PropertyEditorManager.findEditor(propertyType);
    }

    return editor;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号