package org.jnp.interfaces;
import java.io.IOException;
import java.io.Serializable;
import java.rmi.MarshalledObject;
public class MarshalledValuePair implements Serializable
{
private static final long serialVersionUID = -3403843515711139134L;
private static boolean enableCallByReference = true;
public MarshalledObject marshalledValue;
public transient Object value;
public static boolean getEnableCallByReference()
{
return enableCallByReference;
}
public static void setEnableCallByReference(boolean flag)
{
enableCallByReference = flag;
}
public MarshalledValuePair(Object value) throws IOException
{
this.value = value;
this.marshalledValue = new MarshalledObject(value);
}
public Object get() throws ClassNotFoundException, IOException
{
Object theValue = enableCallByReference ? value : null;
if( theValue == null && marshalledValue != null )
theValue = marshalledValue.get();
return theValue;
}
}