1 24 package org.objectweb.jalisto.se.impl.server; 25 26 import org.objectweb.jalisto.se.api.internal.DataWrapper; 27 import org.objectweb.jalisto.se.impl.InFileAddress; 28 29 public class DataWrapperImpl implements DataWrapper { 30 protected Object [] datas; 31 32 public DataWrapperImpl() { 33 } 34 35 public void init(Object [] theDatas) { 36 datas = new Object [theDatas.length]; 37 System.arraycopy(theDatas, 0, datas, 0, theDatas.length); 38 } 39 40 public DataWrapper getClone() { 41 if (datas == null) { 42 return this; 43 } 44 return newInstance(datas); 45 } 46 47 public void setDatas(Object [] newDatas) { 48 if (newDatas.length != datas.length) { 49 datas = new Object [newDatas.length]; 50 } 51 System.arraycopy(newDatas, 0, datas, 0, newDatas.length); 52 } 53 54 public Object [] getDatas() { 55 Object [] result = new Object [datas.length]; 56 System.arraycopy(datas, 0, result, 0, datas.length); 57 return result; 58 } 59 60 public String toString() { 61 StringBuffer sb = new StringBuffer (); 62 sb.append("["); 63 for (int i = 0; i < datas.length; i++) { 64 if (datas[i] == null) { 65 sb.append("null"); 66 } else { 67 sb.append(datas[i]); 68 } 69 if (i != (datas.length - 1)) { 70 sb.append(";"); 71 } 72 } 73 sb.append(']'); 74 return sb.toString(); 75 } 76 77 public InFileAddress getIfa() { 78 return null; 79 } 80 81 public void setIfa(InFileAddress ifa) { 82 } 83 84 public static DataWrapperImpl newInstance(Object [] theDatas) { 85 DataWrapperImpl newObject = new DataWrapperImpl(); 86 newObject.init(theDatas); 87 return newObject; 88 } 89 90 91 static final long serialVersionUID = -7589377097911761459L; 92 } 93 | Popular Tags |