de.grogra.persistence
public class XMLPersistenceWriter extends java.lang.Object implements PersistenceOutput
XMLPersistenceWriter serializes data into
XML elements and attributes. The output can be deserialized
by an instance of XMLPersistenceReader.| Modifier and Type | Field and Description |
|---|---|
protected PersistenceOutputListener |
listener |
static java.lang.String |
NAMESPACE |
static org.xml.sax.Attributes |
NS_ATTRIBUTE |
static java.lang.String |
NS_PREFIX |
| Constructor and Description |
|---|
XMLPersistenceWriter(org.xml.sax.ContentHandler ch,
PersistenceOutputListener listener) |
| Modifier and Type | Method and Description |
|---|---|
void |
beginArray(int length,
Type ct) |
void |
beginExtent(PersistenceManager manager) |
void |
beginField(ManageableType.Field field) |
void |
beginFields() |
boolean |
beginManaged(ManageableType type,
boolean writeType) |
void |
endArray() |
protected void |
endElement(java.lang.String name) |
void |
endExtent() |
void |
endField(ManageableType.Field field) |
void |
endFields() |
void |
endManaged(java.lang.Object object,
boolean writeType) |
void |
getAttributes(PersistenceCapable o,
org.xml.sax.helpers.AttributesImpl attr) |
org.xml.sax.ContentHandler |
getContentHandler() |
void |
setNested(boolean nested) |
protected void |
startElement(java.lang.String name,
org.xml.sax.Attributes attr) |
java.lang.String |
toString(Manageable o)
This method serializes
o into a single string which
may be used, e.g., as an attribute value of an XML element. |
java.lang.String |
toString(Type type,
java.lang.Object o)
This method serializes
o of type type
into a single string which
may be used, e.g., as an attribute value of an XML element. |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeChar(int v) |
void |
writeDouble(double v) |
void |
writeFields(Manageable o) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeName(java.lang.String v) |
void |
writeNullObject() |
void |
writeObject(java.lang.Object v,
Type type) |
void |
writePersistentObjectReference(PersistenceCapable o) |
void |
writeSharedObjectReference(Shareable o) |
void |
writeShort(int v) |
void |
writeString(java.lang.String v) |
void |
writeStringObject(java.lang.String value) |
protected final PersistenceOutputListener listener
public static final java.lang.String NAMESPACE
public static final org.xml.sax.Attributes NS_ATTRIBUTE
public static final java.lang.String NS_PREFIX
public XMLPersistenceWriter(org.xml.sax.ContentHandler ch,
PersistenceOutputListener listener)
public void beginArray(int length,
Type ct)
throws java.io.IOException
beginArray in interface PersistenceOutputjava.io.IOExceptionpublic void beginExtent(PersistenceManager manager) throws java.io.IOException
java.io.IOExceptionpublic void beginField(ManageableType.Field field) throws java.io.IOException
beginField in interface PersistenceOutputjava.io.IOExceptionpublic void beginFields()
beginFields in interface PersistenceOutputpublic boolean beginManaged(ManageableType type, boolean writeType) throws java.io.IOException
beginManaged in interface PersistenceOutputjava.io.IOExceptionpublic void endArray()
throws java.io.IOException
endArray in interface PersistenceOutputjava.io.IOExceptionprotected void endElement(java.lang.String name)
throws java.io.IOException
java.io.IOExceptionpublic void endExtent()
throws java.io.IOException
java.io.IOExceptionpublic void endField(ManageableType.Field field) throws java.io.IOException
endField in interface PersistenceOutputjava.io.IOExceptionpublic void endFields()
endFields in interface PersistenceOutputpublic void endManaged(java.lang.Object object,
boolean writeType)
throws java.io.IOException
endManaged in interface PersistenceOutputjava.io.IOExceptionpublic void getAttributes(PersistenceCapable o, org.xml.sax.helpers.AttributesImpl attr) throws java.io.IOException
java.io.IOExceptionpublic org.xml.sax.ContentHandler getContentHandler()
public void setNested(boolean nested)
setNested in interface PersistenceOutputprotected void startElement(java.lang.String name,
org.xml.sax.Attributes attr)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString(Manageable o)
o into a single string which
may be used, e.g., as an attribute value of an XML element.
The value can be deserialized using
XMLPersistenceReader.valueOf(Manageable, String).o - the value to be serializedopublic java.lang.String toString(Type type, java.lang.Object o)
o of type type
into a single string which
may be used, e.g., as an attribute value of an XML element.
The value can be deserialized using
XMLPersistenceReader.valueOf(Type, String).type - the type of oo - the value to be serializedopublic void writeBoolean(boolean v)
throws java.io.IOException
writeBoolean in interface PersistenceOutputjava.io.IOExceptionpublic void writeByte(int v)
throws java.io.IOException
writeByte in interface PersistenceOutputjava.io.IOExceptionpublic void writeChar(int v)
throws java.io.IOException
writeChar in interface PersistenceOutputjava.io.IOExceptionpublic void writeDouble(double v)
throws java.io.IOException
writeDouble in interface PersistenceOutputjava.io.IOExceptionpublic void writeFields(Manageable o) throws java.io.IOException
java.io.IOExceptionpublic void writeFloat(float v)
throws java.io.IOException
writeFloat in interface PersistenceOutputjava.io.IOExceptionpublic void writeInt(int v)
throws java.io.IOException
writeInt in interface PersistenceOutputjava.io.IOExceptionpublic void writeLong(long v)
throws java.io.IOException
writeLong in interface PersistenceOutputjava.io.IOExceptionpublic void writeName(java.lang.String v)
writeName in interface PersistenceOutputpublic void writeNullObject()
throws java.io.IOException
writeNullObject in interface PersistenceOutputjava.io.IOExceptionpublic void writeObject(java.lang.Object v,
Type type)
throws java.io.IOException
writeObject in interface PersistenceOutputjava.io.IOExceptionpublic void writePersistentObjectReference(PersistenceCapable o) throws java.io.IOException
writePersistentObjectReference in interface PersistenceOutputjava.io.IOExceptionpublic void writeSharedObjectReference(Shareable o) throws java.io.IOException
writeSharedObjectReference in interface PersistenceOutputjava.io.IOExceptionpublic void writeShort(int v)
throws java.io.IOException
writeShort in interface PersistenceOutputjava.io.IOExceptionpublic void writeString(java.lang.String v)
writeString in interface PersistenceOutputpublic void writeStringObject(java.lang.String value)
throws java.io.IOException
writeStringObject in interface PersistenceOutputjava.io.IOException