Interface ObjectEncoder
-
- All Known Implementing Classes:
BinaryObjectEncoder
,XmlObjectEncoder
public interface ObjectEncoder
Interface to abstract away the difference between serializing xml and binary
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
writeBooleanContents(boolean v)
Writes the value in-line.void
writeBooleanField(String fieldName, boolean v)
Writes a boolean.void
writeByteArrayContents(byte[] v)
Special case for byte [] that uses base64 encoding for XMLvoid
writeByteContents(byte v)
Writes the value in-line.void
writeClassContents(Class<?> v)
Writes the value in-line.void
writeClassField(String fieldName, Class<?> v)
Writes a Class.void
writeDoubleContents(double v)
Writes the value in-line.void
writeDoubleField(String fieldName, double v)
Writes a double.void
writeFloatContents(float v)
Writes the value in-line.void
writeFloatField(String fieldName, float v)
Writes a float.void
writeIntContents(int v)
Writes the value in-line.void
writeIntField(String fieldName, int v)
Writes an int.void
writeLongContents(long v)
Writes the value in-line.void
writeLongField(String fieldName, long v)
Writes a long.void
writeObjectContents(Object o)
Writes a sub-objectvoid
writeObjectField(String fieldName, Object object, boolean inline)
Writes an object using the appropriate serializer for that objectvoid
writeStringContents(String str)
Writes the value in-line.void
writeStringField(String fieldName, String v)
Writes a String.
-
-
-
Method Detail
-
writeObjectField
void writeObjectField(String fieldName, Object object, boolean inline)
Writes an object using the appropriate serializer for that object- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the subelement name for xml serializationobject
- The object to serializeinline
- Ignore for binary serialization. For xml serialization, this causes us not to have a sub-element. When inlining, polymorphic typing is not supported.
-
writeBooleanField
void writeBooleanField(String fieldName, boolean v)
Writes a boolean.- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeIntField
void writeIntField(String fieldName, int v)
Writes an int.- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeLongField
void writeLongField(String fieldName, long v)
Writes a long.- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeFloatField
void writeFloatField(String fieldName, float v)
Writes a float.- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeDoubleField
void writeDoubleField(String fieldName, double v)
Writes a double.- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeClassField
void writeClassField(String fieldName, Class<?> v)
Writes a Class.- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeStringField
void writeStringField(String fieldName, String v)
Writes a String.- Parameters:
fieldName
- A hint of the field name. Ignored for binary serialization. Becomes the attribute name for xml serializationv
- The value to serialize
-
writeStringContents
void writeStringContents(String str)
Writes the value in-line.
-
writeBooleanContents
void writeBooleanContents(boolean v)
Writes the value in-line.
-
writeIntContents
void writeIntContents(int v)
Writes the value in-line.
-
writeLongContents
void writeLongContents(long v)
Writes the value in-line.
-
writeFloatContents
void writeFloatContents(float v)
Writes the value in-line.
-
writeDoubleContents
void writeDoubleContents(double v)
Writes the value in-line.
-
writeByteContents
void writeByteContents(byte v)
Writes the value in-line.
-
writeByteArrayContents
void writeByteArrayContents(byte[] v)
Special case for byte [] that uses base64 encoding for XML
-
writeClassContents
void writeClassContents(Class<?> v)
Writes the value in-line.
-
writeObjectContents
void writeObjectContents(Object o)
Writes a sub-object- Parameters:
o
- The object to write
-
-