public class XmlObjectEncoder extends Object implements ObjectEncoder
Constructor and Description |
---|
XmlObjectEncoder(StringBuilder builder) |
Modifier and Type | Method and 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 XML
|
void |
writeByteContents(byte v)
Writes the value in-line.
|
void |
writeClassContents(Class<?> v)
Writes the value in-line.
|
void |
writeClassField(String name,
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.
|
String |
writeObject(Object o) |
void |
writeObjectContents(Object o)
Writes a sub-object
|
void |
writeObjectField(String fieldName,
Object object,
boolean inline)
Writes an object using the appropriate serializer for that object
|
void |
writeStringContents(String str)
Writes the value in-line.
|
void |
writeStringField(String fieldName,
String str)
Writes a String.
|
public XmlObjectEncoder(StringBuilder builder)
public void writeBooleanContents(boolean v)
ObjectEncoder
writeBooleanContents
in interface ObjectEncoder
public void writeBooleanField(String fieldName, boolean v)
ObjectEncoder
writeBooleanField
in interface ObjectEncoder
fieldName
- A hint of the field name. Ignored for binary
serialization. Becomes the attribute name for xml serializationv
- The value to serializepublic void writeByteContents(byte v)
ObjectEncoder
writeByteContents
in interface ObjectEncoder
public void writeByteArrayContents(byte[] v)
ObjectEncoder
writeByteArrayContents
in interface ObjectEncoder
public void writeClassContents(Class<?> v)
ObjectEncoder
writeClassContents
in interface ObjectEncoder
public void writeClassField(String name, Class<?> v)
ObjectEncoder
writeClassField
in interface ObjectEncoder
name
- A hint of the field name. Ignored for binary
serialization. Becomes the attribute name for xml serializationv
- The value to serializepublic void writeDoubleContents(double v)
ObjectEncoder
writeDoubleContents
in interface ObjectEncoder
public void writeDoubleField(String fieldName, double v)
ObjectEncoder
writeDoubleField
in interface ObjectEncoder
fieldName
- A hint of the field name. Ignored for binary
serialization. Becomes the attribute name for xml serializationv
- The value to serializepublic void writeFloatContents(float v)
ObjectEncoder
writeFloatContents
in interface ObjectEncoder
public void writeFloatField(String fieldName, float v)
ObjectEncoder
writeFloatField
in interface ObjectEncoder
fieldName
- A hint of the field name. Ignored for binary
serialization. Becomes the attribute name for xml serializationv
- The value to serializepublic void writeIntContents(int v)
ObjectEncoder
writeIntContents
in interface ObjectEncoder
public void writeIntField(String fieldName, int v)
ObjectEncoder
writeIntField
in interface ObjectEncoder
fieldName
- A hint of the field name. Ignored for binary
serialization. Becomes the attribute name for xml serializationv
- The value to serializepublic void writeLongContents(long v)
ObjectEncoder
writeLongContents
in interface ObjectEncoder
public void writeLongField(String fieldName, long v)
ObjectEncoder
writeLongField
in interface ObjectEncoder
fieldName
- A hint of the field name. Ignored for binary
serialization. Becomes the attribute name for xml serializationv
- The value to serializepublic void writeObjectContents(Object o)
ObjectEncoder
writeObjectContents
in interface ObjectEncoder
o
- The object to writepublic void writeObjectField(String fieldName, Object object, boolean inline)
ObjectEncoder
writeObjectField
in interface ObjectEncoder
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.public void writeStringContents(String str)
ObjectEncoder
writeStringContents
in interface ObjectEncoder
public void writeStringField(String fieldName, String str)
ObjectEncoder
writeStringField
in interface ObjectEncoder
fieldName
- A hint of the field name. Ignored for binary
serialization. Becomes the attribute name for xml serializationstr
- The value to serializeCopyright © 2022. All rights reserved.