Class ObjectToJsonFileExtensions


  • public final class ObjectToJsonFileExtensions
    extends java.lang.Object
    The class ObjectToJsonFileExtensions converts java objects to json file objects.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> void toJsonFile​(T object, java.io.File resultFile)
      Creates a json String from the given argument object
      static <T> void toJsonFile​(T object, java.io.File resultFile, boolean newMapper)
      Creates a json String from the given Object
      static <T> void toJsonFile​(T object, java.io.File resultFile, com.fasterxml.jackson.databind.ObjectMapper mapper)
      Creates a json File from the given Object and the given object mapper
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toJsonFile

        public static <T> void toJsonFile​(T object,
                                          java.io.File resultFile)
                                   throws java.io.IOException
        Creates a json String from the given argument object
        Type Parameters:
        T - the generic type of the given argument object
        Parameters:
        object - the object.
        resultFile - the result file
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • toJsonFile

        public static <T> void toJsonFile​(T object,
                                          java.io.File resultFile,
                                          boolean newMapper)
                                   throws java.io.IOException
        Creates a json String from the given Object
        Type Parameters:
        T - the generic type
        Parameters:
        object - the object
        resultFile - the result file
        newMapper - flag that indicates if a new ObjectMapper should be created. if true a new ObjectMapper will be created otherwise the ObjectMapper from this class will be returned.
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • toJsonFile

        public static <T> void toJsonFile​(T object,
                                          java.io.File resultFile,
                                          com.fasterxml.jackson.databind.ObjectMapper mapper)
                                   throws java.io.IOException
        Creates a json File from the given Object and the given object mapper
        Type Parameters:
        T - the generic type
        Parameters:
        object - the object
        resultFile - the result file
        mapper - the object mapper
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.