Skip to content

Commit

Permalink
pref
Browse files Browse the repository at this point in the history
  • Loading branch information
magicianlib committed Feb 15, 2025
1 parent f971456 commit 85dd409
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,15 @@ public static JsonNode toObj(String json) {
}
}

public static <T> T toObj(String json, Class<T> parametrized, Class<?>... parameterClasses) {
try {
JavaType javaType = MAPPER.getTypeFactory().constructParametricType(parametrized, parameterClasses);
return MAPPER.readValue(json, javaType);
} catch (IOException e) {
throw new DeserializationException(e);
}
}

/**
* 将 JSON 字符串转换为指定集合类型
*/
Expand Down

0 comments on commit 85dd409

Please sign in to comment.