1 22 package org.jnp.interfaces; 23 24 import java.io.IOException ; 25 import java.io.Serializable ; 26 import java.rmi.MarshalledObject ; 27 28 35 public class MarshalledValuePair implements Serializable 36 { 37 38 private static final long serialVersionUID = -3403843515711139134L; 39 40 private static boolean enableCallByReference = true; 41 public MarshalledObject marshalledValue; 42 public transient Object value; 43 44 48 public static boolean getEnableCallByReference() 49 { 50 return enableCallByReference; 51 } 52 56 public static void setEnableCallByReference(boolean flag) 57 { 58 enableCallByReference = flag; 59 } 60 61 62 public MarshalledValuePair(Object value) throws IOException 63 { 64 this.value = value; 65 this.marshalledValue = new MarshalledObject (value); 66 } 67 68 public Object get() throws ClassNotFoundException , IOException 69 { 70 Object theValue = enableCallByReference ? value : null; 71 if( theValue == null && marshalledValue != null ) 72 theValue = marshalledValue.get(); 73 return theValue; 74 } 75 } 76 | Popular Tags |