diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 9ae306b..e439363 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,5 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=13
org.eclipse.jdt.core.compiler.compliance=13
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
diff --git a/pom.xml b/pom.xml
index 42dd1aa..9a6d4e7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
4.0.0
serialization
- 0.1.3
+ 0.1.4
Serialization
jar
diff --git a/src/main/java/info/unterrainer/commons/serialization/JsonMapper.java b/src/main/java/info/unterrainer/commons/serialization/JsonMapper.java
index f3e806d..1ae226e 100644
--- a/src/main/java/info/unterrainer/commons/serialization/JsonMapper.java
+++ b/src/main/java/info/unterrainer/commons/serialization/JsonMapper.java
@@ -5,8 +5,8 @@
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.TreeNode;
import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -14,6 +14,7 @@
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.databind.introspect.AnnotatedClass;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
+import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.AccessLevel;
@@ -59,6 +60,10 @@ public JsonPOJOBuilder.Value findPOJOBuilderConfig(final AnnotatedClass ac) {
return s;
}
+ public TypeFactory getTypeFactory() {
+ return objectMapper.getTypeFactory();
+ }
+
public String toStringFrom(final T sourceObject) {
try {
return objectMapper.writeValueAsString(sourceObject);
@@ -77,9 +82,9 @@ public T fromStringTo(final Class targetClass, final String sourceJson) {
}
}
- public T fromTreeTo(final Class targetClass, final TreeNode treeNode) {
+ public T fromStringTo(final JavaType targetClass, final String sourceJson) {
try {
- return objectMapper.treeToValue(treeNode, targetClass);
+ return objectMapper.readValue(sourceJson, targetClass);
} catch (JsonMappingException e) {
throw new info.unterrainer.commons.serialization.exceptions.JsonMappingException(e.getMessage(), e);
} catch (JsonProcessingException e) {