Class ResultJsonConverter

java.lang.Object
com.amalgamasimulation.studies.result.ResultJsonConverter

public class ResultJsonConverter extends Object
Class for converting between Result objects and JSON representations. Provides methods for serializing Result objects to JSON strings and deserializing JSON strings back to SimulationRunResult objects.
  • Constructor Details

    • ResultJsonConverter

      public ResultJsonConverter()
  • Method Details

    • convertResultToJson

      public String convertResultToJson(Result result)
      Converts a Result object to its JSON string representation.
      Parameters:
      result - the Result object to convert
      Returns:
      JSON string representation of the Result object
      Throws:
      IllegalStateException - if the conversion fails due to:
      • IO errors during JSON generation
      • Presence of null values in the Result object
    • convertJsonToResult

      public SimulationRunResult convertJsonToResult(String json)
      Converts a JSON string back to a SimulationRunResult object.
      Parameters:
      json - the JSON string to parse
      Returns:
      the reconstructed SimulationRunResult object
      Throws:
      IllegalStateException - if the parsing fails due to:
      • Malformed JSON input
      • IO errors during parsing