Package club.someoneice.json
Class JSON
java.lang.Object
club.someoneice.json.JSON
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionJsonNode<?> 从文件读取并解析为 JsonNode。JsonNode<?> parse(InputStream inputStream, boolean shouldClose) 从输入流读取并解析为 JsonNode。内建关闭流。如shouldClose为true,请内联创建。JsonNode<?> 从字符串解析为 JsonNode。tryPullArrayOrEmpty(JsonNode<?> jsonNode) Deprecated.Deprecated.<T> TtryPullAsClass(Class<? extends T> clazz, File file) <T> TtryPullAsClass(Class<? extends T> clazz, String str) <T> TtryPullAsClass(Class<T> clazz, MapNode jsonMap) <T> List<T> tryPullAsClassList(Class<? extends T> clazz, File file) <T> List<T> tryPullAsClassList(Class<? extends T> clazz, String str) tryPullObjectOrEmpty(JsonNode<?> jsonNode) Deprecated.Deprecated.<T> MapNodetryPushFromClass(T clazz)
-
Field Details
-
json
-
json5
-
-
Method Details
-
parse
从文件读取并解析为 JsonNode。- Parameters:
file- 将要解析的文件。- Returns:
- 处理后的未知类型的 JsonNode。
-
parse
从输入流读取并解析为 JsonNode。内建关闭流。如shouldClose为true,请内联创建。- Parameters:
inputStream- 将要解析的输入流。shouldClose- 决定流是否需要内部自动关闭。- Returns:
- 处理后的未知类型的 JsonNode。
-
parse
从字符串解析为 JsonNode。- Parameters:
str- 将要解析的字符串。- Returns:
- 处理后的未知类型的 JsonNode。
-
tryPullArrayOrEmpty
Deprecated.- Parameters:
jsonNode- 需要转型为 ArrayNode 的 JsonNode。- Returns:
- 符合时提供确定的 ArrayNode,否则提供空的 ArrayNode。
-
tryPullArrayOrEmpty
Deprecated.- Parameters:
raw- 需要转型为 ArrayNode 的字符串,自动解析后转义。- Returns:
- 符合时提供确定的 ArrayNode,否则提供空的 ArrayNode。
-
tryPullObjectOrEmpty
Deprecated.- Parameters:
jsonNode- 需要转型为 MapNode 的 JsonNode。- Returns:
- 符合时提供确定的 MapNode,否则提供空的 MapNode。
-
tryPullObjectOrEmpty
Deprecated.- Parameters:
raw- 需要转型为 MapNode 的字符串,自动解析后转义。- Returns:
- 符合时提供确定的 MapNode,否则提供空的 MapNode。
-
tryPullAsClass
public <T> T tryPullAsClass(Class<? extends T> clazz, String str) throws InstantiationException, IllegalAccessException -
tryPullAsClass
public <T> T tryPullAsClass(Class<? extends T> clazz, File file) throws InstantiationException, IllegalAccessException -
tryPullAsClass
public <T> T tryPullAsClass(Class<T> clazz, MapNode jsonMap) throws InstantiationException, IllegalAccessException -
tryPushFromClass
- Throws:
IllegalAccessException
-
tryPullAsClassList
public <T> List<T> tryPullAsClassList(Class<? extends T> clazz, String str) throws InstantiationException, IllegalAccessException -
tryPullAsClassList
public <T> List<T> tryPullAsClassList(Class<? extends T> clazz, File file) throws InstantiationException, IllegalAccessException
-
JsonNode.asArrayNodeOrEmpty()