mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix get null bug
This commit is contained in:
@@ -34,7 +34,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
* @return true 无此key或值为{@code null}或{@link JSONNull#NULL}返回{@code false},其它返回{@code true}
|
||||
*/
|
||||
default boolean isNull(K key) {
|
||||
return JSONNull.NULL.equals(this.getObj(key));
|
||||
return JSONUtil.isNull(this.getObj(key));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
*/
|
||||
default JSONArray getJSONArray(K key) {
|
||||
final Object object = this.getObj(key);
|
||||
if (null == object) {
|
||||
if (JSONUtil.isNull(object)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
*/
|
||||
default JSONObject getJSONObject(K key) {
|
||||
final Object object = this.getObj(key);
|
||||
if (null == object) {
|
||||
if (JSONUtil.isNull(object)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
default Date getDate(K key, Date defaultValue) {
|
||||
// 默认转换
|
||||
final Object obj = getObj(key);
|
||||
if (null == obj) {
|
||||
if (JSONUtil.isNull(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (obj instanceof Date) {
|
||||
@@ -151,7 +151,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
default LocalDateTime getLocalDateTime(K key, LocalDateTime defaultValue) {
|
||||
// 默认转换
|
||||
final Object obj = getObj(key);
|
||||
if (null == obj) {
|
||||
if (JSONUtil.isNull(obj)) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (obj instanceof LocalDateTime) {
|
||||
@@ -202,7 +202,7 @@ public interface JSONGetter<K> extends OptNullBasicTypeFromObjectGetter<K> {
|
||||
*/
|
||||
default <T> T get(K key, Class<T> type, boolean ignoreError) throws ConvertException {
|
||||
final Object value = this.getObj(key);
|
||||
if (null == value) {
|
||||
if (JSONUtil.isNull(value)) {
|
||||
return null;
|
||||
}
|
||||
return JSONConverter.jsonConvert(type, value, ignoreError);
|
||||
|
Reference in New Issue
Block a user