org.jboss.marshalling.serial
Class ExternalizedObject

java.lang.Object
  extended by org.jboss.marshalling.serial.ExternalizedObject
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, Creator

public final class ExternalizedObject
extends java.lang.Object
implements java.io.Externalizable, Creator

An externalized object. This wrapper allows an object that was written with an Externalizer to be read by standard Java serialization. Note that if an externalized object's child object graph ever refers to the original object, there will be an error in the reconstructed object graph such that those references will refer to this wrapper object rather than the properly externalized object.

See Also:
Serialized Form

Constructor Summary
ExternalizedObject()
           
ExternalizedObject(Externalizer externalizer, java.lang.Object obj)
           
 
Method Summary
<T> T
create(java.lang.Class<T> clazz)
          Create an object instance.
 void readExternal(java.io.ObjectInput in)
          
 java.lang.Object readResolve()
          Return the externalized object after readExternal() completes.
 void writeExternal(java.io.ObjectOutput out)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalizedObject

public ExternalizedObject()

ExternalizedObject

public ExternalizedObject(Externalizer externalizer,
                          java.lang.Object obj)
Method Detail

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readResolve

public java.lang.Object readResolve()
                             throws java.io.ObjectStreamException
Return the externalized object after readExternal() completes.

Returns:
the externalized object
Throws:
java.io.ObjectStreamException - never

create

public <T> T create(java.lang.Class<T> clazz)
         throws java.io.InvalidClassException
Create an object instance.

Specified by:
create in interface Creator
Parameters:
clazz - the type of object to create
Returns:
the object instance
Throws:
java.io.InvalidClassException - if an instance of the class could not be instantiated for some reason