Package io.github.astrapi69.json
Class JsonFileToObjectExtensions
- java.lang.Object
-
- io.github.astrapi69.json.JsonFileToObjectExtensions
-
public final class JsonFileToObjectExtensions extends java.lang.Object
The classJsonFileToObjectExtensions
converts json strings to java object and java collections.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T
toObject(java.io.File jsonFile, com.fasterxml.jackson.core.type.TypeReference<T> typeReference, com.fasterxml.jackson.databind.ObjectMapper mapper)
Transforms the given json file into a java object.static <T> T
toObject(java.io.File jsonFile, java.lang.Class<T> clazz, com.fasterxml.jackson.databind.ObjectMapper mapper)
Transforms the given json file into a java object.
-
-
-
Method Detail
-
toObject
public static <T> T toObject(java.io.File jsonFile, java.lang.Class<T> clazz, com.fasterxml.jackson.databind.ObjectMapper mapper) throws java.io.IOException
Transforms the given json file into a java object.- Type Parameters:
T
- the generic type- Parameters:
jsonFile
- the json fileclazz
- the clazzmapper
- the mapper- Returns:
- the t
- Throws:
java.io.IOException
- Signals that an I/O exception has occurred
-
toObject
public static <T> T toObject(java.io.File jsonFile, com.fasterxml.jackson.core.type.TypeReference<T> typeReference, com.fasterxml.jackson.databind.ObjectMapper mapper) throws java.io.IOException
Transforms the given json file into a java object.- Type Parameters:
T
- the generic type- Parameters:
jsonFile
- the json filetypeReference
- the type referencemapper
- the mapper- Returns:
- the t
- Throws:
java.io.IOException
- Signals that an I/O exception has occurred
-
-