Package com.blackrook.json.converters
Class JSONDateFormatConverter
java.lang.Object
com.blackrook.json.converters.JSONDateFormatConverter
- All Implemented Interfaces:
JSONConverter<Date>
- Direct Known Subclasses:
JSONISODateTimeConverter
A special converter that converts dates from strings to Dates in JSON member data.
- Since:
- 1.3.0
- Author:
- Matthew Tropiano
-
Constructor Summary
ConstructorsConstructorDescriptionJSONDateFormatConverter(String format) Creates a new converter using aSimpleDateFormatstring.JSONDateFormatConverter(String format, TimeZone timeZone) Creates a new converter using aSimpleDateFormatstring. -
Method Summary
Modifier and TypeMethodDescriptiongetJSONObject(Date 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.
-
Constructor Details
-
JSONDateFormatConverter
Creates a new converter using aSimpleDateFormatstring.- Parameters:
format- the format string.
-
JSONDateFormatConverter
Creates a new converter using aSimpleDateFormatstring.- Parameters:
format- the format string.timeZone- the date's target timezone before conversion.
-
-
Method Details
-
getJSONObject
Description copied from interface:JSONConverterReturns 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 viaJSONConverter.getObject(JSONObject)with close-to or dead-on 100% equivalence.- Specified by:
getJSONObjectin interfaceJSONConverter<Date>- Parameters:
object- the object to inspect.- Returns:
- an accurate JSONObject that represents this object.
-
getObject
Description copied from interface:JSONConverterReturns a Java Object that is equivalent to the input JSON Object.- Specified by:
getObjectin interfaceJSONConverter<Date>- Parameters:
jsonObject- the JSON Object to convert.- Returns:
- an accurate object from the JSON.
-