mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
change name
This commit is contained in:
parent
775afa68cc
commit
ea070bf83e
@ -10,6 +10,8 @@
|
||||
* 【core 】 multipart中int改为long,解决大文件上传越界问题(issue#I27WZ3@Gitee)
|
||||
* 【core 】 ListUtil.page增加检查(pr#224@Gitee)
|
||||
* 【db 】 Db增加使用sql的page方法(issue#247@Gitee)
|
||||
* 【cache 】 CacheObj的isExpired()逻辑修改(issue#1295@Github)
|
||||
* 【json 】 JSONStrFormater改为JSONStrFormatter
|
||||
|
||||
### Bug修复
|
||||
* 【cache 】 修复Cache中get重复misCount计数问题(issue#1281@Github)
|
||||
|
@ -44,9 +44,8 @@ public class CacheObj<K, V> implements Serializable{
|
||||
*/
|
||||
boolean isExpired() {
|
||||
if(this.ttl > 0) {
|
||||
final long expiredTime = this.lastAccess + this.ttl;
|
||||
// expiredTime > 0 杜绝Long类型溢出变负数问题,当当前时间超过过期时间,表示过期
|
||||
return expiredTime > 0 && expiredTime < System.currentTimeMillis();
|
||||
// 此处不考虑时间回拨
|
||||
return (System.currentTimeMillis() - this.lastAccess) > this.ttl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -115,7 +115,8 @@ public class JSONConfig implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置日期格式,null表示默认的时间戳
|
||||
* 设置日期格式,null表示默认的时间戳<br>
|
||||
* 此方法设置的日期格式仅对转换为JSON字符串有效,对解析JSON为bean无效。
|
||||
*
|
||||
* @param dateFormat 日期格式,null表示默认的时间戳
|
||||
* @return this
|
||||
|
@ -261,7 +261,8 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置转为字符串时的日期格式,默认为时间戳(null值)
|
||||
* 设置转为字符串时的日期格式,默认为时间戳(null值)<br>
|
||||
* 此方法设置的日期格式仅对转换为JSON字符串有效,对解析JSON为bean无效。
|
||||
*
|
||||
* @param format 格式,null表示使用时间戳
|
||||
* @return this
|
||||
@ -341,7 +342,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT 键值对到JSONObject中,在忽略null模式下,如果值为<code>null</code>,将此键移除
|
||||
* PUT 键值对到JSONObject中,在忽略null模式下,如果值为{@code null},将此键移除
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值对象. 可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL.
|
||||
@ -356,7 +357,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置键值对到JSONObject中,在忽略null模式下,如果值为<code>null</code>,将此键移除
|
||||
* 设置键值对到JSONObject中,在忽略null模式下,如果值为{@code null},将此键移除
|
||||
*
|
||||
* @param key 键
|
||||
* @param value 值对象. 可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL.
|
||||
@ -426,7 +427,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
* @param key 键
|
||||
* @param value 被积累的值
|
||||
* @return this.
|
||||
* @throws JSONException 如果给定键为<code>null</code>或者键对应的值存在且为非JSONArray
|
||||
* @throws JSONException 如果给定键为{@code null}或者键对应的值存在且为非JSONArray
|
||||
*/
|
||||
public JSONObject accumulate(String key, Object value) throws JSONException {
|
||||
InternalJSONUtil.testValidity(value);
|
||||
@ -447,7 +448,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
* @param key 键
|
||||
* @param value 值
|
||||
* @return this.
|
||||
* @throws JSONException 如果给定键为<code>null</code>或者键对应的值存在且为非JSONArray
|
||||
* @throws JSONException 如果给定键为{@code null}或者键对应的值存在且为非JSONArray
|
||||
*/
|
||||
public JSONObject append(String key, Object value) throws JSONException {
|
||||
InternalJSONUtil.testValidity(value);
|
||||
@ -545,7 +546,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
|
||||
/**
|
||||
* 返回JSON字符串<br>
|
||||
* 如果解析错误,返回<code>null</code>
|
||||
* 如果解析错误,返回{@code null}
|
||||
*
|
||||
* @return JSON字符串
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
* @author looly
|
||||
* @since 3.1.2
|
||||
*/
|
||||
public class JSONStrFormater {
|
||||
public class JSONStrFormatter {
|
||||
|
||||
/** 单位缩进字符串。*/
|
||||
private static final String SPACE = " ";
|
@ -776,7 +776,7 @@ public final class JSONUtil {
|
||||
* @since 3.1.2
|
||||
*/
|
||||
public static String formatJsonStr(String jsonStr) {
|
||||
return JSONStrFormater.format(jsonStr);
|
||||
return JSONStrFormatter.format(jsonStr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,21 +13,21 @@ public class JSONStrFormaterTest {
|
||||
@Test
|
||||
public void formatTest() {
|
||||
String json = "{'age':23,'aihao':['pashan','movies'],'name':{'firstName':'zhang','lastName':'san','aihao':['pashan','movies','name':{'firstName':'zhang','lastName':'san','aihao':['pashan','movies']}]}}";
|
||||
String result = JSONStrFormater.format(json);
|
||||
String result = JSONStrFormatter.format(json);
|
||||
Assert.assertNotNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void formatTest2() {
|
||||
String json = "{\"abc\":{\"def\":\"\\\"[ghi]\"}}";
|
||||
String result = JSONStrFormater.format(json);
|
||||
String result = JSONStrFormatter.format(json);
|
||||
Assert.assertNotNull(result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void formatTest3() {
|
||||
String json = "{\"id\":13,\"title\":\"《标题》\",\"subtitle\":\"副标题z'c'z'xv'c'xv\",\"user_id\":6,\"type\":0}";
|
||||
String result = JSONStrFormater.format(json);
|
||||
String result = JSONStrFormatter.format(json);
|
||||
Assert.assertNotNull(result);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user