1 package com.daffodilwoods.rmi.interfaces; 2 3 import java.io.Externalizable ; 4 import java.io.ObjectOutput ; 5 import java.io.IOException ; 6 import java.io.ObjectInput ; 7 8 public class Parameters 9 implements Externalizable { 10 Object parameters; 11 16 17 int type; 18 public static int OBJECT_ARRAY = 0; 19 public static int HASHMAP = 1; 20 public static int VARIABLEVALUE = 2; 21 boolean blobClobPresent; 22 23 public Parameters() { 24 } 25 26 public void setObjects(Object params) { 27 parameters = params; 28 } 29 30 public void setType(int type0) { 31 type = type0; 32 } 33 34 public void setBlobClobPresent(){ 35 blobClobPresent = true; 36 } 37 public Object getObjects() { 38 return parameters; 39 } 40 41 public int getType() { 42 return type; 43 } 44 45 public boolean isBlobClobPresent(){ 46 return blobClobPresent; 47 } 48 49 public void writeExternal(ObjectOutput out) throws IOException { 50 out.writeInt(type); 51 boolean noParameters = parameters == null; 52 out.writeBoolean(noParameters); 53 out.writeBoolean(blobClobPresent); 54 if (noParameters == false) { 55 if (type == OBJECT_ARRAY) { 56 Object [] params = (Object []) parameters; 57 out.writeInt(params.length); 58 for (int i = 0; i < params.length; i++) { 59 out.writeObject(params[i]); 60 } 61 } 62 else { 63 out.writeInt(0); 64 out.writeObject(parameters); 65 } 66 } 67 } 68 69 public void readExternal(ObjectInput in) throws IOException , 70 ClassNotFoundException { 71 type = in.readInt(); 72 boolean noParameters = in.readBoolean(); 73 blobClobPresent = in.readBoolean(); 74 if (noParameters == false) { 75 int count = in.readInt(); 76 if (type == OBJECT_ARRAY) { 77 Object [] params = new Object [count]; 78 for (int i = 0; i < count; i++) { 79 params[i] = in.readObject(); 80 } 81 parameters = params; 82 } 83 else 84 parameters = in.readObject(); 85 } 86 } 87 88 } 89 | Popular Tags |