Class ObjectToJsonFileExtensions

java.lang.Object
io.github.astrapi69.json.ObjectToJsonFileExtensions

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

    • toJsonFile

      public static <T> void toJsonFile(T object, File resultFile) throws 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:
      IOException - Signals that an I/O exception has occurred.
    • toJsonFile

      public static <T> void toJsonFile(T object, File resultFile, boolean newMapper) throws 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:
      IOException - Signals that an I/O exception has occurred.
    • toJsonFile

      public static <T> void toJsonFile(T object, File resultFile, com.fasterxml.jackson.databind.ObjectMapper mapper) throws 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:
      IOException - Signals that an I/O exception has occurred.