com.objectwave.persist.file
Class ObjectBuilder

java.lang.Object
  |
  +--com.objectwave.persist.file.ObjectBuilder

public class ObjectBuilder
extends java.lang.Object

Build the DomainObjects from the byte array from the file.

Version:
$Id: ObjectBuilder.java,v 2.2 2001/11/02 16:07:56 dave_hoag Exp $
Author:
Dave Hoag

Field Summary
static ObjectFormatter defaultFormatter
           
 
Constructor Summary
ObjectBuilder()
           
 
Method Summary
 Persistence buildObject(Persistence queryObject, byte[] data, java.lang.Object pkeyData)
          Build the Object from the byte []
static ObjectBuilder getInstance()
          Gets the Instance attribute of the ObjectBuilder class
protected static RDBPersistence getRDBAdapter(Persistence object)
          A utility method that simplifies code.
 byte[] getSaveData(RDBPersistence pObj)
          Convert the data in the object to a byte [] of data.
protected  boolean isMatch(RDBPersistence one, RDBPersistence two)
           
protected  void readPrimitive(java.io.DataInputStream dos, AttributeTypeColumn col, Persistence obj)
          Read the primitive values from the input stream.
protected  void readReference(java.lang.String pkey, AttributeTypeColumn col, Persistence obj, RDBPersistence pObj, Persistence queryObject)
          Utility method that does the work of other methods.
protected  void setPrimaryKeyValues(java.lang.Object pkeyData, Persistence result, RDBPersistence pResult)
           
protected  void writePrimitive(java.io.DataOutputStream dos, AttributeTypeColumn col, Persistence obj)
          Write the primitive value to the output stream.
protected  void writeReference(java.io.DataOutputStream dos, RDBPersistence pFkData, RDBPersistence pObj, Persistence fkData, AttributeTypeColumn fkCol)
          Utility method that does the work of other methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultFormatter

public static ObjectFormatter defaultFormatter
Constructor Detail

ObjectBuilder

public ObjectBuilder()
Method Detail

getInstance

public static ObjectBuilder getInstance()
Gets the Instance attribute of the ObjectBuilder class

Returns:
The Instance value

getRDBAdapter

protected static final RDBPersistence getRDBAdapter(Persistence object)
A utility method that simplifies code. Users of this broker are expected to use an RDBPersistence implementation.

Parameters:
object -
Returns:
The RDBAdapter value

setPrimaryKeyValues

protected void setPrimaryKeyValues(java.lang.Object pkeyData,
                                   Persistence result,
                                   RDBPersistence pResult)
Parameters:
pkeyData - The new PrimaryKeyValues value
result - The new PrimaryKeyValues value
pResult - The new PrimaryKeyValues value

getSaveData

public byte[] getSaveData(RDBPersistence pObj)
Convert the data in the object to a byte [] of data.

Parameters:
pObj -
Returns:
The byte array that is the data found in the provided object

isMatch

protected boolean isMatch(RDBPersistence one,
                          RDBPersistence two)
Parameters:
one -
two -
Returns:
The Match value

buildObject

public Persistence buildObject(Persistence queryObject,
                               byte[] data,
                               java.lang.Object pkeyData)
                        throws java.lang.InstantiationException,
                               java.lang.IllegalAccessException
Build the Object from the byte []

Parameters:
queryObject -
data -
pkeyData -
Returns:
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

readReference

protected void readReference(java.lang.String pkey,
                             AttributeTypeColumn col,
                             Persistence obj,
                             RDBPersistence pObj,
                             Persistence queryObject)
                      throws java.io.IOException,
                             java.lang.InstantiationException,
                             java.lang.IllegalAccessException
Utility method that does the work of other methods. Get the actual databaseIdentifier that refers to the other Persistent object. Modifies the Object array passed as fkData to contain the databaseIdentifiers and not the acutal Persistent object.

Parameters:
col -
obj -
pObj -
queryObject -
pkey -
Throws:
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException

writeReference

protected void writeReference(java.io.DataOutputStream dos,
                              RDBPersistence pFkData,
                              RDBPersistence pObj,
                              Persistence fkData,
                              AttributeTypeColumn fkCol)
                       throws java.io.IOException
Utility method that does the work of other methods. Get the actual databaseIdentifier that refers to the other Persistent object. Modifies the Object array passed as fkData to contain the databaseIdentifiers and not the acutal Persistent object.

Parameters:
dos -
pFkData -
pObj -
fkData -
fkCol -
Throws:
java.io.IOException

writePrimitive

protected void writePrimitive(java.io.DataOutputStream dos,
                              AttributeTypeColumn col,
                              Persistence obj)
                       throws java.io.IOException
Write the primitive value to the output stream.

Parameters:
dos -
col -
obj -
Throws:
java.io.IOException

readPrimitive

protected void readPrimitive(java.io.DataInputStream dos,
                             AttributeTypeColumn col,
                             Persistence obj)
                      throws java.io.IOException
Read the primitive values from the input stream.

Parameters:
dos -
col -
obj -
Throws:
java.io.IOException