+ // Just the following if there is no returned value
+ //tc.handleStruct(data);
+ StructJ[] retStruct = tc.handleStruct(data);
+ // Return length first
+ int structsize2 = retStruct.length;
+ Object retObj = structsize2;
+ rmiObj.sendReturnObj(retObj);
+ // Send the actual struct members
+ // Calculate the size of the array
+ Class<?>[] retCls = new Class<?>[3*structsize2];
+ Object[] retObj2 = new Object[3*structsize2];
+ // Handle with for loop
+ pos = 0;
+ for(int i = 0; i < structsize2; i++) {
+ retCls[pos] = String.class;
+ retObj2[pos++] = data[i].name;
+ retCls[pos] = float.class;
+ retObj2[pos++] = data[i].value;
+ retCls[pos] = int.class;
+ retObj2[pos++] = data[i].year;
+ }
+ rmiObj.sendReturnObj(retCls, retObj2);
+ }
+
+
+ public EnumJ[] handleEnum(EnumJ[] en) {
+
+ return tc.handleEnum(en);
+ }
+
+
+ public void ___handleEnum() throws IOException {
+
+ Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int[].class },
+ new Class<?>[] { null });
+ // Encoder/decoder
+ int paramInt[] = (int[]) paramObj[0];
+ int enumSize1 = paramInt.length;
+ EnumJ[] enumJ = EnumJ.values();
+ EnumJ[] data = new EnumJ[enumSize1];
+ for (int i=0; i < enumSize1; i++) {
+ data[i] = enumJ[paramInt[i]];
+ }
+ // if void, just "handleEnum(data)"
+ // this is when we have return value EnumJ[]
+ EnumJ[] retEnum = handleEnum(data);
+ // Get length first
+ int enumSize2 = retEnum.length;
+ // Now send the array of integers
+ int[] retEnumInt = new int[enumSize2];
+ for (int i=0; i < enumSize2; i++) {
+ retEnumInt[i] = retEnum[i].ordinal();
+ }
+ Object retObj = retEnumInt;
+ rmiObj.sendReturnObj(retObj);