com.davisor.data
Class ObjectType

java.lang.Object
  extended byjava.text.Format
      extended bycom.davisor.data.Type
          extended bycom.davisor.data.VoidType
              extended bycom.davisor.data.ObjectType
All Implemented Interfaces:
java.lang.Cloneable, java.util.Comparator, com.davisor.core.Dupable, java.io.Serializable

public class ObjectType
extends VoidType

ObjectType defines a generic object data type that supports object values.

Since:
JDK1.1
See Also:
ObjectValue, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.text.Format
java.text.Format.Field
 
Field Summary
static ObjectType DEFAULT
          Default object type.
static java.lang.String TYPENAME
          Type name ("OBJECT").
 
Fields inherited from class com.davisor.data.VoidType
M_preserveNulls
 
Fields inherited from class com.davisor.data.Type
METADATA_GROUP, METADATA_NAME, METADATA_PARENT, METADATA_SUBCHANNELS
 
Constructor Summary
  ObjectType()
          Default constructor.
  ObjectType(ObjectType ot)
          Copy constructor.
  ObjectType(java.lang.String dataName)
          Creates a new default type with no identity.
  ObjectType(java.lang.String dataName, java.lang.String id, java.lang.String format)
          Creates a new object type.
protected ObjectType(java.lang.String typeName, java.lang.String dataName, java.lang.String id, java.util.Map metaData, boolean preserveNulls)
          Creates a new object type.
 
Method Summary
 com.davisor.core.Dupable dup()
          Makes a deep copy of this object.
 int getSQLCode()
          Gets the default java.sql.Types SQL type code.
 java.lang.Class getValueClass()
          Gets value container class.
 DataValue toData(java.sql.CallableStatement statement, int column)
          Converts a callable statement variable to a data value.
 DataValue toData(java.lang.Object objectValue)
          Converts an object to a data value.
 DataValue toData(java.sql.ResultSet resultSet, int column)
          Converts a result set column value to a data value.
 DataValue toData(java.lang.String stringValue, java.text.ParsePosition status)
          Converts a string to a data value.
 DataValue zero()
          Gets zero data value for this type.
 
Methods inherited from class com.davisor.data.VoidType
isVoidType, preserveNulls, preserveNulls
 
Methods inherited from class com.davisor.data.Type
ceil, check, check, compare, create, create, create, create, create, dup, equals, floor, format, getCompatibility, getDataName, getFormat, getId, getID, getMetaData, getMetaData, getSpecs, getSQLName, getSQLName, getTypeName, hashCode, isNull, parseObject, register, register, setDataName, setFormat, setId, setID, setMetaData, setMetaData, setSpecs, toString, toXML, xmlEnd, xmlStart
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final ObjectType DEFAULT
Default object type.


TYPENAME

public static final java.lang.String TYPENAME
Type name ("OBJECT").

See Also:
Constant Field Values
Constructor Detail

ObjectType

public ObjectType()
Default constructor.


ObjectType

public ObjectType(ObjectType ot)
Copy constructor.


ObjectType

public ObjectType(java.lang.String dataName)
Creates a new default type with no identity.

Parameters:
dataName - data name (may be null)

ObjectType

public ObjectType(java.lang.String dataName,
                  java.lang.String id,
                  java.lang.String format)
Creates a new object type.

This is the constructor the SQL type mapper Type.create(Integer,String,String,String) method will call to create a type that matches given SQL type.

Parameters:
dataName - data name (may be null)
id - type identity (may be null)
format - type spesification (may be null)

ObjectType

protected ObjectType(java.lang.String typeName,
                     java.lang.String dataName,
                     java.lang.String id,
                     java.util.Map metaData,
                     boolean preserveNulls)
Creates a new object type.

Parameters:
typeName - type name
dataName - data name (may be null)
id - type identity (may be null)
metaData - type meta data map (may be null)
preserveNulls - keep or convert null values
Method Detail

dup

public com.davisor.core.Dupable dup()
Makes a deep copy of this object.

Specified by:
dup in interface com.davisor.core.Dupable
Overrides:
dup in class VoidType

getSQLCode

public int getSQLCode()
Gets the default java.sql.Types SQL type code.

Overrides:
getSQLCode in class Type
Returns:
Types.BLOB.

getValueClass

public java.lang.Class getValueClass()
Gets value container class.

Overrides:
getValueClass in class VoidType

toData

public DataValue toData(java.sql.CallableStatement statement,
                        int column)
                 throws InvalidDataException,
                        java.sql.SQLException
Converts a callable statement variable to a data value.

Object value is read from given statement as a Blob. The blob binary stream is then invoked, and the actual object value is read from there.

Overrides:
toData in class VoidType
Parameters:
statement - statement holding the data value to be converted
column - SQL column index for the data value to be converted
Returns:
a data value object corresponding to given object value
Throws:
InvalidDataException - if given object value could not be parsed
java.sql.SQLException - if a SQL error occurs
See Also:
toData(Object), toData(ResultSet,int), toData(String,ParsePosition), ObjectValue

toData

public DataValue toData(java.lang.Object objectValue)
                 throws InvalidDataException
Converts an object to a data value.

Overrides:
toData in class VoidType
Parameters:
objectValue - data object
Returns:
a data value object corresponding to given object value
Throws:
InvalidDataException - if given object value could not be parsed
See Also:
toData(CallableStatement,int), toData(ResultSet,int), toData(String,ParsePosition), ObjectValue

toData

public DataValue toData(java.lang.String stringValue,
                        java.text.ParsePosition status)
                 throws InvalidDataException
Converts a string to a data value.

Overrides:
toData in class VoidType
Parameters:
stringValue - data string (may be null)
status - parse status (may be null)
Returns:
a data value object corresponding given string value
Throws:
InvalidDataException - if given string value could not be parsed
See Also:
toData(CallableStatement,int), toData(Object), toData(ResultSet,int), ObjectValue

toData

public DataValue toData(java.sql.ResultSet resultSet,
                        int column)
                 throws InvalidDataException,
                        java.sql.SQLException
Converts a result set column value to a data value.

Overrides:
toData in class VoidType
Parameters:
resultSet - resultSet holding the data value to be converted
column - SQL column index for the data value to be converted
Returns:
a data value object corresponding to given object value
Throws:
InvalidDataException - if given object value could not be parsed
java.sql.SQLException - if a SQL error occurs
See Also:
toData(CallableStatement,int), toData(Object), toData(String,ParsePosition), ObjectValue

zero

public DataValue zero()
Gets zero data value for this type.

Overrides:
zero in class VoidType
Returns:
a new VoidValue value
Throws:
java.lang.Error - always since this operation is undefined


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.