org.jboss.cache.marshall
Class MarshalledValue

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

public class MarshalledValue
extends Object
implements 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@jboss.org)
See Also:
MarshalledValueInterceptor, Serialized Form

Field Summary
protected  Object instance
           
protected  byte[] raw
           
 
Constructor Summary
MarshalledValue()
           
MarshalledValue(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(Object o)
           
 Object get()
           
 int hashCode()
           
 void readExternal(ObjectInput in)
           
 void serialize()
           
 void setEqualityPreferenceForInstance(boolean equalityPreferenceForInstance)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

instance

protected Object instance

raw

protected byte[] raw
Constructor Detail

MarshalledValue

public MarshalledValue(Object instance)
                throws NotSerializableException
Throws:
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(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

get

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

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


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