Skip to content

Commit 783ae6a

Browse files
committed
fix: 优化 Json 工具类方法名称
1 parent dda5dba commit 783ae6a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

simple-application/src/test/java/top/cadecode/common/util/JsonUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void str2Obj() {
3737
" \"name\" : \"map\",\n" +
3838
" \"writer\" : \"Cade\"\n" +
3939
"}";
40-
Map<String, String> map = JsonUtil.str2Obj(str, new TypeReference<Map<String, String>>() {});
40+
Map<String, String> map = JsonUtil.strToObj(str, new TypeReference<Map<String, String>>() {});
4141
log.info("map: {}", map);
4242
}
4343

simple-common/src/main/java/top/cadecode/common/util/JsonUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static String objToStr(Object obj, boolean isPretty) {
8383
* @return 自定义对象
8484
*/
8585
@SuppressWarnings("unchecked")
86-
public static <T> T str2Obj(String str, Class<T> clazz) {
86+
public static <T> T strToObj(String str, Class<T> clazz) {
8787
if (!StringUtils.hasLength(str) || clazz == null) {
8888
return null;
8989
}
@@ -105,7 +105,7 @@ public static <T> T str2Obj(String str, Class<T> clazz) {
105105
* @return 自定义对象
106106
*/
107107
@SuppressWarnings("unchecked")
108-
public static <T> T str2Obj(String str, TypeReference<T> typeReference) {
108+
public static <T> T strToObj(String str, TypeReference<T> typeReference) {
109109
if (!StringUtils.hasLength(str) || typeReference == null) {
110110
return null;
111111
}

0 commit comments

Comments
 (0)