MCPcopy Create free account
hub / github.com/diyhi/bbs / toObject

Method toObject

src/main/java/cms/component/JsonComponent.java:72–88  ·  view source on GitHub ↗

Json字符串转Java对象 @param jsonString json字符串 @param c 类 @return

(String jsonString, Class<?> c)

Source from the content-addressed store, hash-verified

70 * @return
71 */
72 public <T> T toObject(String jsonString, Class<?> c) {
73
74 if (jsonString == null || jsonString.isEmpty()) {
75
76 return (T) "";
77 } else {
78 try {
79 return (T)objectMapper.readValue(jsonString, c);
80 } catch (Exception e) {
81 if (logger.isErrorEnabled()) {
82 logger.error("Json字符串转Java对象",e);
83 }
84 }
85
86 }
87 return (T) "";
88 }
89
90}

Callers 15

queryWeChatConfigMethod · 0.80
queryWeiXinOpenIdMethod · 0.80
queryWeiXinUserInfoMethod · 0.80
queryOtherConfigMethod · 0.80
queryOtherAccessTokenMethod · 0.80
queryOtherUserInfoMethod · 0.80
queryUserRoleNameMethod · 0.80
updateMethod · 0.80

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected