Interface ObjectEncoder
-
- All Known Implementing Classes:
BinaryObjectEncoder,XmlObjectEncoder
public interface ObjectEncoderInterface to abstract away the difference between serializing xml and binary
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidwriteBooleanContents(boolean v)Writes the value in-line.voidwriteBooleanField(String fieldName, boolean v)Writes a boolean.voidwriteByteArrayContents(byte[] v)Special case for byte [] that uses base64 encoding for XMLvoidwriteByteContents(byte v)Writes the value in-line.voidwriteClassContents(Class<?> v)Writes the value in-line.voidwriteClassField(String fieldName, Class<?> v)Writes a Class.voidwriteDoubleContents(double v)Writes the value in-line.voidwriteDoubleField(String fieldName, double v)Writes a double.voidwriteFloatContents(float v)Writes the value in-line.voidwriteFloatField(String fieldName, float v)Writes a float.voidwriteIntContents(int v)Writes the value in-line.voidwriteIntField(String fieldName, int v)Writes an int.voidwriteLongContents(long v)Writes the value in-line.voidwriteLongField(String fieldName, long v)Writes a long.voidwriteObjectContents(Object o)Writes a sub-objectvoidwriteObjectField(String fieldName, Object object, boolean inline)Writes an object using the appropriate serializer for that objectvoidwriteStringContents(String str)Writes the value in-line.voidwriteStringField(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
-
-