Class JSONDateMillisConverter

java.lang.Object
com.blackrook.json.converters.JSONDateMillisConverter
All Implemented Interfaces:
JSONConverter<Date>

public class JSONDateMillisConverter extends Object implements JSONConverter<Date>
A special converter that converts dates from milliseconds since Epoch to Dates in JSON member data.
Since:
1.3.0
Author:
Matthew Tropiano
  • Constructor Details

    • JSONDateMillisConverter

      public JSONDateMillisConverter()
      Creates a new converter.
  • Method Details

    • getJSONObject

      public JSONObject getJSONObject(Date object)
      Description copied from interface: JSONConverter
      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 JSONConverter.getObject(JSONObject) with close-to or dead-on 100% equivalence.
      Specified by:
      getJSONObject in interface JSONConverter<Date>
      Parameters:
      object - the object to inspect.
      Returns:
      an accurate JSONObject that represents this object.
    • getObject

      public Date getObject(JSONObject jsonObject)
      Description copied from interface: JSONConverter
      Returns a Java Object that is equivalent to the input JSON Object.
      Specified by:
      getObject in interface JSONConverter<Date>
      Parameters:
      jsonObject - the JSON Object to convert.
      Returns:
      an accurate object from the JSON.