Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jcorporate.expresso.core.dataobjects
Class DataTransferObject  view DataTransferObject download DataTransferObject.java

java.lang.Object
  extended bycom.jcorporate.expresso.core.dataobjects.DataTransferObject
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public final class DataTransferObject
extends java.lang.Object
implements java.io.Externalizable

Basic HashMap wrapper for the Data Transfer Object pattern. The goal of this class is to provide efficient serialization over the wire of DBOBjects and or the up and coming DataObjects. By encapsulating the 'data guts' of the data objects into this class, routing programs that don't have to know anything about a particular instance of a DBObject/DataObject don't have to have any large code base installed on them.

The other advantage of DataTransferObject is serialization size. On tests conducted 3/17/04, the size of com.jcorporate.expresso.services.dbobj.MimeTypes was 1310 bytes. The size of the same item converted into a DataTransfer object was 293 bytes. For in-memory serialization alone, this translates to twice as fast. For slower connections such as sockets, this speed translation will be more pronounced.

Since:
Expresso 5.0

Field Summary
private  java.lang.String dataContext
           
private static java.lang.String EMPTY_STRING
           
private  java.lang.String objectClassName
           
private  java.util.HashMap tableFields
           
 
Constructor Summary
DataTransferObject()
           
 
Method Summary
 java.lang.String getDataContext()
           
 java.lang.String getObjectClassName()
           
 java.util.Map getTableFields()
          Gets the table fields in bulk
 void readExternal(java.io.ObjectInput ois)
          Optimized Deserialization
 void setDataContext(java.lang.String dataContext)
           
 void setObjectClassName(java.lang.String objectClassName)
          Sets the classname of the DataObject we're attached to so that we can instantiate it at the far end of the wire.
 void setTableFields(java.util.Map tableFields)
          Sets the data fields in bulk.
 void writeExternal(java.io.ObjectOutput oos)
          Optimized Serialization implementation that does not utilize any reflection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_STRING

private static final transient java.lang.String EMPTY_STRING
See Also:
Constant Field Values

tableFields

private java.util.HashMap tableFields

dataContext

private java.lang.String dataContext

objectClassName

private java.lang.String objectClassName
Constructor Detail

DataTransferObject

public DataTransferObject()
Method Detail

readExternal

public void readExternal(java.io.ObjectInput ois)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
Optimized Deserialization

Specified by:
readExternal in interface java.io.Externalizable

writeExternal

public void writeExternal(java.io.ObjectOutput oos)
                   throws java.io.IOException
Optimized Serialization implementation that does not utilize any reflection

Specified by:
writeExternal in interface java.io.Externalizable

setTableFields

public void setTableFields(java.util.Map tableFields)
Sets the data fields in bulk. Does not perform a data copy unless the passed in type is not a HashMap


getTableFields

public java.util.Map getTableFields()
Gets the table fields in bulk


setDataContext

public void setDataContext(java.lang.String dataContext)

getDataContext

public java.lang.String getDataContext()

setObjectClassName

public void setObjectClassName(java.lang.String objectClassName)
Sets the classname of the DataObject we're attached to so that we can instantiate it at the far end of the wire.


getObjectClassName

public java.lang.String getObjectClassName()