fix issue#503

This commit is contained in:
Looly
2019-08-21 16:46:05 +08:00
parent 2f2c9e58d2
commit 3928cbb21f
4 changed files with 49 additions and 22 deletions

View File

@@ -7,6 +7,7 @@ import java.util.Date;
/**
* 基本类型的getter接口<br>
* 提供一个统一的接口定义返回不同类型的值(基本类型)<br>
*
* @author Looly
*/
public interface BasicTypeGetter<K> {
@@ -14,6 +15,7 @@ public interface BasicTypeGetter<K> {
/**
* 获取Object属性值
*
* @param key 属性名
* @return 属性值
*/
@@ -119,6 +121,7 @@ public interface BasicTypeGetter<K> {
/**
* 获取Date类型值
*
* @param key 属性名
* @return Date类型属性值
*/

View File

@@ -297,6 +297,19 @@ public class Dict extends LinkedHashMap<String, Object> implements BasicTypeGett
return super.get(key);
}
/**
* 获得特定类型值
*
* @param <T> 值类型
* @param attr 字段名
* @param defaultValue 默认值
* @return 字段值
* @since 4.6.3
*/
public <T> T getBean(String attr) {
return get(attr, null);
}
/**
* 获得特定类型值
*

View File

@@ -3,6 +3,7 @@ package cn.hutool.core.swing;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.util.URLUtil;
@@ -31,9 +32,19 @@ public class DesktopUtil {
* @param url URL地址
*/
public static void browse(String url) {
browse(URLUtil.toURI(url));
}
/**
* 使用平台默认浏览器打开指定URI地址
*
* @param uri URI地址
* @since 4.6.3
*/
public static void browse(URI uri) {
final Desktop dsktop = getDsktop();
try {
dsktop.browse(URLUtil.toURI(url));
dsktop.browse(uri);
} catch (IOException e) {
throw new IORuntimeException(e);
}

View File

@@ -285,7 +285,7 @@ public class JschUtil {
} catch (IOException e) {
throw new IORuntimeException(e);
} catch (JSchException e) {
throw new IORuntimeException(e);
throw new JschRuntimeException(e);
} finally {
IoUtil.close(in);
close(channel);