Class Writers.UUIDWriter

java.lang.Object
com.cedarsoftware.util.io.Writers.UUIDWriter
All Implemented Interfaces:
JsonWriter.JsonClassWriter
Enclosing class:
Writers

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

    • UUIDWriter

      public UUIDWriter()
  • Method Details

    • write

      public void write(Object obj, boolean showType, Writer output, WriterContext context) throws IOException
      To preserve backward compatibility with previous serialized format the internal fields must be stored as longs
      Specified by:
      write in interface JsonWriter.JsonClassWriter
      Parameters:
      obj - Object to be written in JSON format.
      showType - boolean indicating whether to show @type.
      output - Writer destination to where the actual JSON is written.
      context - WriterContext to get writeOptions and other write access
      Throws:
      IOException - if thrown by the writer. Will be caught at a higher level and wrapped in JsonIoException.
    • hasPrimitiveForm

      public boolean hasPrimitiveForm()
      Specified by:
      hasPrimitiveForm in interface JsonWriter.JsonClassWriter
      Returns:
      boolean true if the class being written has a primitive (non-object) form. Default is false since most custom writers will not have a primitive form.
    • writePrimitiveForm

      public void writePrimitiveForm(Object o, Writer writer) throws IOException
      We can use the String representation for easier handling, but this may break backwards compatibility if an earlier library version is used
      Specified by:
      writePrimitiveForm in interface JsonWriter.JsonClassWriter
      Parameters:
      o - Object to be written
      writer - Writer destination to where the actual JSON is written.
      Throws:
      IOException - if thrown by the writer. Will be caught at a higher level and wrapped in JsonIoException.