com.novell.sentinel.json.java
Class JSONDateHandlerJava

java.lang.Object
  extended by com.novell.sentinel.json.java.JSONDateHandlerJava
All Implemented Interfaces:
JSONDateHandler

public class JSONDateHandlerJava
extends Object
implements JSONDateHandler

Implementation of JSONDateHandler for use in a Java environment (as opposed to GWT or something like it). This is implemented as a singleton; use getInstance() to get the instance.

See Also:
JSONDateHandler

Field Summary
 
Fields inherited from interface com.novell.sentinel.json.JSONDateHandler
ISO_DATETIME_FORMAT
 
Method Summary
 String format(Date date)
          Serialize a date to the format specified by ISO_DATETIME_FORMAT.
static JSONDateHandlerJava getInstance()
          Return the instance of the implementation to use.
 Date parse(String dateString)
          Parse a string that should be serialized date the format specified by ISO_DATETIME_FORMAT.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static JSONDateHandlerJava getInstance()
Return the instance of the implementation to use.

Returns:
The singleton instance.

parse

public Date parse(String dateString)
           throws ParseException
Description copied from interface: JSONDateHandler
Parse a string that should be serialized date the format specified by ISO_DATETIME_FORMAT.

Specified by:
parse in interface JSONDateHandler
Parameters:
dateString - The input.
Returns:
The Date object corresponding to the parsed string.
Throws:
ParseException - If the input is not in the correct format.
See Also:
JSONDateHandler.ISO_DATETIME_FORMAT

format

public String format(Date date)
Description copied from interface: JSONDateHandler
Serialize a date to the format specified by ISO_DATETIME_FORMAT.

Specified by:
format in interface JSONDateHandler
Parameters:
date - The input.
Returns:
The serialized data.