1 64 65 package com.jcorporate.expresso.core.dataobjects; 66 67 import java.io.Externalizable ; 68 import java.io.IOException ; 69 import java.util.HashMap ; 70 import java.util.Map ; 71 72 89 90 public final class DataTransferObject implements Externalizable { 91 transient private static final String EMPTY_STRING = ""; 92 93 private java.util.HashMap tableFields = new HashMap (); 94 private String dataContext; 95 private String objectClassName; 96 97 98 public DataTransferObject() { 99 } 100 101 102 110 public void readExternal(java.io.ObjectInput ois) throws ClassNotFoundException , IOException { 111 tableFields = (HashMap ) ois.readObject(); 112 dataContext = ois.readUTF(); 113 objectClassName = ois.readUTF(); 114 } 115 116 117 123 public void writeExternal(java.io.ObjectOutput oos) throws IOException { 124 oos.writeObject(tableFields); 125 if (dataContext == null) { 126 oos.writeUTF(EMPTY_STRING); 127 } else { 128 oos.writeUTF(dataContext); 129 } 130 131 if (objectClassName == null) { 132 oos.writeUTF(EMPTY_STRING); 133 } else { 134 oos.writeUTF(objectClassName); 135 } 136 137 } 138 139 140 146 public void setTableFields(Map tableFields) { 147 if (tableFields instanceof HashMap ) { 148 this.tableFields = (HashMap ) tableFields; 149 } else { 150 this.tableFields = new HashMap (tableFields); 151 } 152 } 153 154 159 public java.util.Map getTableFields() { 160 return tableFields; 161 } 162 163 166 public void setDataContext(String dataContext) { 167 this.dataContext = dataContext; 168 } 169 170 173 public String getDataContext() { 174 return dataContext; 175 } 176 177 183 public void setObjectClassName(String objectClassName) { 184 this.objectClassName = objectClassName; 185 } 186 187 public String getObjectClassName() { 188 return objectClassName; 189 } 190 191 } | Popular Tags |