Class Writers.DateWriter

java.lang.Object
com.cedarsoftware.io.Writers.DateWriter
All Implemented Interfaces:
JsonClassWriter
Direct Known Subclasses:
Writers.DateAsLongWriter
Enclosing class:
Writers

public static class Writers.DateWriter extends Object implements JsonClassWriter
  • Constructor Details

    • DateWriter

      public DateWriter()
  • Method Details

    • writePrimitiveForm

      public void writePrimitiveForm(Object o, Writer output, WriterContext context) throws IOException
      Description copied from interface: JsonClassWriter
      Write the object in its primitive JSON form (without surrounding braces). Only called if JsonClassWriter.hasPrimitiveForm(WriterContext) returns true.
      Specified by:
      writePrimitiveForm in interface JsonClassWriter
      Parameters:
      o - Object to be written
      output - Writer destination where the JSON is written
      context - WriterContext providing access to WriteOptions and writing tools
      Throws:
      IOException - if an I/O error occurs during writing
    • write

      public void write(Object obj, boolean showType, Writer output, WriterContext context) throws IOException
      Description copied from interface: JsonClassWriter
      Write the object in JSON format to the output Writer.
      Specified by:
      write in interface JsonClassWriter
      Parameters:
      obj - Object to be written in JSON format
      showType - boolean indicating whether to include @type in the output
      output - Writer destination where the JSON is written
      context - WriterContext providing access to WriteOptions and other write utilities
      Throws:
      IOException - if an I/O error occurs during writing
    • hasPrimitiveForm

      public boolean hasPrimitiveForm(WriterContext context)
      Description copied from interface: JsonClassWriter
      Indicates whether this class has a primitive (non-object) JSON form. Most custom writers will not have a primitive form, so the default is false.
      Specified by:
      hasPrimitiveForm in interface JsonClassWriter
      Parameters:
      context - WriterContext providing access to WriteOptions
      Returns:
      true if this class can be written as a JSON primitive value