Package com.cedarsoftware.io
Class Writers.UUIDWriter
java.lang.Object
com.cedarsoftware.io.Writers.UUIDWriter
- All Implemented Interfaces:
JsonWriter.JsonClassWriter
- Enclosing class:
- Writers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasPrimitiveForm
(WriterContext writerContext) void
write
(Object obj, boolean showType, Writer output, WriterContext context) To preserve backward compatibility with previous serialized format the internal fields must be stored as longsvoid
writePrimitiveForm
(Object o, Writer writer, WriterContext writerContext) We can use the String representation for easier handling, but this may break backwards compatibility if an earlier library version is used
-
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 interfaceJsonWriter.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
- Specified by:
hasPrimitiveForm
in interfaceJsonWriter.JsonClassWriter
- Parameters:
writerContext
- WriterContext to get writeOptions and other write access- 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, WriterContext writerContext) 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 interfaceJsonWriter.JsonClassWriter
- Parameters:
o
- Object to be writtenwriter
- Writer destination to where the actual JSON is written.writerContext
- WriterContext to get access to writeOptions and writing tools- Throws:
IOException
- if thrown by the writer. Will be caught at a higher level and wrapped in JsonIoException.
-