diff --git a/README.md b/README.md index 45e1e32..9c625b1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ repositories { } dependencies { - implementation 'com.github.qw623577789:qtk-json:v1.12.0' + implementation 'com.github.qw623577789:qtk-json:v1.13.0' } ``` diff --git a/build.gradle b/build.gradle index cc658a4..d6fdf50 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ plugins { } group = "team.qtk" -version = "1.12.0" +version = "1.13.0" sourceCompatibility = 11 targetCompatibility = 11 diff --git a/src/main/java/team/qtk/json/JSON.java b/src/main/java/team/qtk/json/JSON.java index 934db57..680c317 100644 --- a/src/main/java/team/qtk/json/JSON.java +++ b/src/main/java/team/qtk/json/JSON.java @@ -1,12 +1,13 @@ package team.qtk.json; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.core.FormatFeature; import com.fasterxml.jackson.core.PrettyPrinter; import com.fasterxml.jackson.core.json.JsonReadFeature; import com.fasterxml.jackson.core.json.JsonWriteFeature; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; @@ -734,13 +735,17 @@ public JSONConfig(JsonMapper.Builder customJacksonBuilder) { this.customJacksonBuilder = customJacksonBuilder; } - public JSONConfig features(HashMap features) { + public JSONConfig features(HashMap features) { features .forEach((key, value) -> { if (key instanceof JsonReadFeature) { customJacksonBuilder.configure((JsonReadFeature) key, value); } else if (key instanceof JsonWriteFeature) { customJacksonBuilder.configure((JsonWriteFeature) key, value); + } else if (key instanceof SerializationFeature) { + customJacksonBuilder.configure((SerializationFeature) key, value); + } else if (key instanceof DeserializationFeature) { + customJacksonBuilder.configure((DeserializationFeature) key, value); } else { throw new RuntimeException("no support feature:" + ((Object) key).getClass().getName()); }