IntrospectionSupport.java 文件源码

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

项目:aries-rsa 作者:
private static Object convert(Object value, Class<?> type) {
    if( type.isArray() ) {
        if( value.getClass().isArray() ) {
            int length = Array.getLength(value);
            Class<?> componentType = type.getComponentType();
            Object rc = Array.newInstance(componentType, length);
            for (int i = 0; i < length; i++) {
                Object o = Array.get(value, i);
                Array.set(rc, i, convert(o, componentType));
            }
            return rc;
        }
    }
    PropertyEditor editor = PropertyEditorManager.findEditor(type);
    if (editor != null) {
        editor.setAsText(value.toString());
        return editor.getValue();
    }
    return null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号