Class JsonFileToObjectExtensions


  • public final class JsonFileToObjectExtensions
    extends java.lang.Object
    The class JsonFileToObjectExtensions 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 file
        clazz - the clazz
        mapper - 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 file
        typeReference - the type reference
        mapper - the mapper
        Returns:
        the t
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred