org.jboss.aop.util
Class MarshalledValue

java.lang.Object
  extended by org.jboss.aop.util.MarshalledValue
All Implemented Interfaces:
Externalizable, Serializable

public class MarshalledValue
extends Object
implements Externalizable

A simple replacement for the RMI MarshalledObject that uses the thread context class loader for resolving classes and proxies. This currently does not support class annotations and dynamic class loading.

Version:
$Revision: 74557 $
Author:
Scott.Stark@jboss.org
See Also:
Serialized Form

Constructor Summary
MarshalledValue()
          Exposed for externalization.
MarshalledValue(Object obj)
           
 
Method Summary
 boolean equals(Object obj)
          Compares obj with this instance for equality.
 Object get()
           
 int hashCode()
          Return a hash code for the serialized form of the value.
 void readExternal(ObjectInput in)
          The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 int size()
          Returns the length of this value's serialized form.
 byte[] toByteArray()
          Returns the serialized form of this value.
 void writeExternal(ObjectOutput out)
          The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarshalledValue

public MarshalledValue()
Exposed for externalization.


MarshalledValue

public MarshalledValue(Object obj)
                throws IOException
Throws:
IOException
Method Detail

get

public Object get()
           throws IOException,
                  ClassNotFoundException
Throws:
IOException
ClassNotFoundException

toByteArray

public byte[] toByteArray()
Returns the serialized form of this value.

Returns:
the serialized form of this value

size

public int size()
Returns the length of this value's serialized form.

Returns:
the length of toByteArray()

hashCode

public int hashCode()
Return a hash code for the serialized form of the value.

Overrides:
hashCode in class Object
Returns:
the serialized form value hash.

equals

public boolean equals(Object obj)
Compares obj with this instance for equality. Returns true if and only if obj is also a marshalled value, whose value is the same as the one contained in this instance.

Overrides:
equals in class Object
Parameters:
obj - the object to be compared for equality with this instance
Returns:
true if obj is considered equal to this instance

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Specified by:
readExternal in interface Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur


Copyright © 2008 JBoss, a division of Red Hat, Inc.. All Rights Reserved.