org.jboss.cache.marshall
Class MarshalledValue

java.lang.Object
  extended by org.jboss.cache.marshall.MarshalledValue
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class MarshalledValue
extends java.lang.Object
implements java.io.Externalizable

Wrapper that wraps cached data, providing lazy deserialization using the calling thread's context class loader.

The MarshalledValueInterceptor handles transparent wrapping/unwrapping of cached data.

Since:
2.1.0
Author:
Manik Surtani (manik AT jboss DOT org)
See Also:
MarshalledValueInterceptor, Serialized Form

Field Summary
protected  java.lang.Object instance
           
protected  byte[] raw
           
 
Constructor Summary
MarshalledValue()
           
MarshalledValue(java.lang.Object instance)
           
 
Method Summary
 void compact(boolean preferSerializedRepresentation, boolean force)
          Compacts the references held by this class to a single reference.
 void deserialize()
           
 boolean equals(java.lang.Object o)
           
 java.lang.Object get()
           
 int hashCode()
           
 void readExternal(java.io.ObjectInput in)
           
 void serialize()
           
 void setEqualityPreferenceForInstance(boolean equalityPreferenceForInstance)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

instance

protected java.lang.Object instance

raw

protected byte[] raw
Constructor Detail

MarshalledValue

public MarshalledValue(java.lang.Object instance)
                throws java.io.NotSerializableException
Throws:
java.io.NotSerializableException

MarshalledValue

public MarshalledValue()
Method Detail

setEqualityPreferenceForInstance

public void setEqualityPreferenceForInstance(boolean equalityPreferenceForInstance)

serialize

public void serialize()

deserialize

public void deserialize()

compact

public void compact(boolean preferSerializedRepresentation,
                    boolean force)
Compacts the references held by this class to a single reference. If only one representation exists this method is a no-op unless the 'force' parameter is used, in which case the reference held is forcefully switched to the 'preferred representation'.

Either way, a call to compact() will ensure that only one representation is held.

Parameters:
preferSerializedRepresentation - if true and both representations exist, the serialized representation is favoured. If false, the deserialized representation is preferred.
force - ensures the preferred representation is maintained and the other released, even if this means serializing or deserializing.

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

get

public java.lang.Object get()
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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