com.objectwave.persist
Class ObjectFormatter
java.lang.Object
|
+--com.objectwave.utility.ObjectFormatter
|
+--com.objectwave.persist.ObjectFormatter
- Direct Known Subclasses:
- AccessObjectFormatter, FileMakerObjectFormatter, FileObjectFormatter, OracleObjectFormatter
- public class ObjectFormatter
- extends ObjectFormatter
This class converts data from one type to another. Used extensively for
persistence manipulation.
- Version:
- $Id: ObjectFormatter.java,v 2.1 2002/03/23 13:42:10 dave_hoag Exp $
- Author:
- Dave Hoag
Method Summary |
void |
bindBlob(java.sql.PreparedStatement statement,
byte[] data,
int idx)
|
boolean |
convertArrays(java.lang.Object[] map,
AttributeTypeColumn[] cols)
If we have an Array of a scalar datatype, we may store that in the database
as a long string. |
java.lang.Object |
convertType(AttributeTypeColumn col,
java.lang.Object obj)
Convert the data represented by 'obj' to the correct data type as specified
by 'col'. |
void |
convertTypes(java.lang.Object[] data,
AttributeTypeColumn[] cols)
If we have an Array of a scalar datatype, we may store that in the database
as a long string. |
boolean |
needsArrayConversion(AttributeTypeColumn col)
Check to see the the field represented by this AttributeTypeColumn is a
native array. |
Methods inherited from class com.objectwave.utility.ObjectFormatter |
bytesToString, convertArray, convertPrimitive, convertString, convertType, createArray, createNumber, createScalarType, formatDate, formatSerializable, formatValue, formatValue, readSerializable, replace1QuoteWith2, serializeObject, stringToBytes |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ObjectFormatter
public ObjectFormatter()
bindBlob
public void bindBlob(java.sql.PreparedStatement statement,
byte[] data,
int idx)
throws java.sql.SQLException
- Parameters:
statement
- data
- idx
-
- Throws:
java.sql.SQLException
convertTypes
public void convertTypes(java.lang.Object[] data,
AttributeTypeColumn[] cols)
- If we have an Array of a scalar datatype, we may store that in the database
as a long string. This method will convert the long string into an array of
the scalar data types. This method will convert the data from the database
into the correct format for the Object.
- Parameters:
data
- cols
-
convertType
public java.lang.Object convertType(AttributeTypeColumn col,
java.lang.Object obj)
- Convert the data represented by 'obj' to the correct data type as specified
by 'col'.
- Parameters:
col
- AttributeTypeColumn from a class description.obj
-
- Returns:
- An instance of the expected type.
needsArrayConversion
public boolean needsArrayConversion(AttributeTypeColumn col)
- Check to see the the field represented by this AttributeTypeColumn is a
native array.
- Parameters:
col
-
- Returns:
convertArrays
public boolean convertArrays(java.lang.Object[] map,
AttributeTypeColumn[] cols)
- If we have an Array of a scalar datatype, we may store that in the database
as a long string. This method will convert the array into a long string.
I've used '\n' the new line character to sperate entries. This could cause
problems but many of the other characters were having troubles getting in
an out of the datatbase.
- Parameters:
map
- cols
-
- Returns: