|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.serializer.GenericXStreamSerializer
public class GenericXStreamSerializer
Serializer that uses XStream to serialize and deserialize arbitrary objects.
When running on a Sun JVM, XStream does not pose any restrictions on classes to serialize. On other JVM's, however, you need to either implement Serializable, or provide a default constructor (accessible under the JVM's security policy). That means that for portability, you should do either of these two.
XStream| Constructor Summary | |
|---|---|
GenericXStreamSerializer()
Initialize a generic serializer using the UTF-8 character set. |
|
GenericXStreamSerializer(Charset charset)
Initialize the serializer using the given charset. |
|
GenericXStreamSerializer(Charset charset,
com.thoughtworks.xstream.XStream xStream)
Initialize the serializer using the given charset and xStream instance. |
|
| Method Summary | |
|---|---|
void |
addAlias(String name,
Class type)
Adds an alias to use instead of the fully qualified class name. |
void |
addFieldAlias(String alias,
Class definedIn,
String fieldName)
Adds an alias to use for a given field in the given class. |
void |
addPackageAlias(String alias,
String pkgName)
Add an alias for a package. |
Object |
deserialize(com.thoughtworks.xstream.io.HierarchicalStreamReader reader)
Deserialize an object using the given dom4j Document. |
Object |
deserialize(InputStream inputStream)
Deserialize an object using the bytes in the given inputStream. |
com.thoughtworks.xstream.XStream |
getXStream()
Returns a reference to the underlying XStream instance, that does the actual
serialization. |
void |
serialize(Object object,
OutputStream outputStream)
Serialize the given object and write the bytes to the given outputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GenericXStreamSerializer()
XppDriver) is used to perform the serialization.
public GenericXStreamSerializer(Charset charset)
charset. A default XStream instance (with XppDriver) is used to perform the serialization.
charset - The character set to use
public GenericXStreamSerializer(Charset charset,
com.thoughtworks.xstream.XStream xStream)
charset and xStream instance. The
xStream instance is configured with several converters for the most common types in Axon.
charset - The character set to usexStream - The XStream instance to use| Method Detail |
|---|
public void serialize(Object object,
OutputStream outputStream)
object and write the bytes to the given outputStream. Bytes are
written using the character set provided during initialization of the serializer.
object - The object to serialize.outputStream - The stream to write bytes topublic Object deserialize(InputStream inputStream)
inputStream - The input stream providing the bytes of the serialized object
public Object deserialize(com.thoughtworks.xstream.io.HierarchicalStreamReader reader)
reader - The hierarchical stream reader providing the data for the object to deserialize
public void addAlias(String name,
Class type)
name - The alias to usetype - The Class to use the alias forXStream.alias(String, Class)
public void addPackageAlias(String alias,
String pkgName)
alias - The alias to use.pkgName - The package to use the alias forXStream.aliasPackage(String, String)
public void addFieldAlias(String alias,
Class definedIn,
String fieldName)
alias - The alias to use instead of the original field namedefinedIn - The class that defines the field.fieldName - The name of the field to use the alias forXStream.aliasField(String, Class, String)public com.thoughtworks.xstream.XStream getXStream()
XStream instance, that does the actual
serialization.
XStream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||