Interface JSONConverter<T>

Type Parameters:
T - the object type that this converter converts to JSON and back.
All Known Implementing Classes:
JSONDateFormatConverter, JSONDateMillisConverter, JSONDefaultConverter, JSONISODateTimeConverter

public interface JSONConverter<T>
JSON converters. Converts between JSON objects to Java Objects and back.
Author:
Matthew Tropiano
  • Method Summary

    Modifier and Type
    Method
    Description
    getJSONObject(T object)
    Returns a JSON object that represents this object instance (and its contents).
    getObject(JSONObject jsonObject)
    Returns a Java Object that is equivalent to the input JSON Object.
  • Method Details

    • getJSONObject

      JSONObject getJSONObject(T object)
      Returns a JSON object that represents this object instance (and its contents). The policy of this method is to help return something that can be converted back to Java via getObject(JSONObject) with close-to or dead-on 100% equivalence.
      Parameters:
      object - the object to inspect.
      Returns:
      an accurate JSONObject that represents this object.
      Throws:
      JSONConversionException - if object conversion fails.
    • getObject

      T getObject(JSONObject jsonObject)
      Returns a Java Object that is equivalent to the input JSON Object.
      Parameters:
      jsonObject - the JSON Object to convert.
      Returns:
      an accurate object from the JSON.
      Throws:
      JSONConversionException - if object conversion fails.