Class JSONFile

java.lang.Object
net.hironico.common.utils.json.JSONFile

public class JSONFile extends Object
  • Constructor Details

    • JSONFile

      public JSONFile()
  • Method Details

    • serialize

      public static String serialize(Object obj) throws com.fasterxml.jackson.core.JsonProcessingException
      Serialize to JSON string the object given as parameter, If it is a ResultSet then special handling is made in this class. Please note that if passed a resultset object, then the resultset is NOT closed by this method.
      Parameters:
      obj - is the object to serialize in JSON
      Returns:
      the serialized version of the passed object in JSON format.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - in case of any problem during serialization
    • parse

      public static <T> T parse(String jsonStr, Class<T> clazz) throws IOException
      Throws:
      IOException
    • load

      public static <T> T load(InputStream in, Class<T> clazz) throws IOException
      Throws:
      IOException
    • load

      public static <T> T load(File file, Class<T> clazz) throws IOException
      Throws:
      IOException
    • saveAs

      public static boolean saveAs(File file, Object obj) throws IOException
      Throws:
      IOException