public interface Externalizer<T> extends Serializable
Externalizerimplementation for the type that they want to marshall/unmarshall, and then annotate the marshalled type class with
SerializeWithindicating the externalizer class to use and that's all about it. At runtime JBoss Marshaller will inspect the object and discover that's marshallable thanks to the annotation and so marshall it using the externalizer class passed. It's common practice to include externalizer implementations within the classes that they marshall/unmarshall as
public static classes. To make externalizer implementations easier to code and more typesafe, make sure you define type
SerializeWithbut a user might need to provide an Externalizer for a class for which source code is not available, or for any other constraints, it cannot be modified.
AdvancedExternalizer. More details can be found in this interface's javadoc.
void writeObject(ObjectOutput output, T object) throws IOException
output- the object output to write to
object- the object reference to write
IOException- if an I/O error occurs
T readObject(ObjectInput input) throws IOException, ClassNotFoundException
writeObject(ObjectOutput, Object)method. Implementations are free to create instances of the object read from the stream in any way that they feel like. This could be via constructor, factory or reflection.
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.