com.davisor.data
Class VoidType

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

public class VoidType
extends Type

VoidType defines a degenerated void data type that supports null and VoidValue values.

VoidType has a preserverNullsnull values are treated when they pass through this type. The default (false) is to convert null values to VoidValue instances. The alternative (true) is keep the null values as null values.

Since:
JDK1.1
See Also:
preserveNulls(), preserveNulls(boolean), VoidData, VoidValue, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.text.Format
java.text.Format.Field
 
Field Summary
static VoidType DEFAULT
          Default void type.
protected  boolean M_preserveNulls
          Keep or convert null values (default: convert).
static java.lang.String TYPENAME
          Type name ("VOID").
 
Fields inherited from class com.davisor.data.Type
METADATA_GROUP, METADATA_NAME, METADATA_PARENT, METADATA_SUBCHANNELS
 
Constructor Summary
  VoidType()
          Default constructor.
  VoidType(java.lang.String dataName, java.lang.String id, java.util.Map metaData, boolean preserveNulls)
          Creates a new void type instance.
  VoidType(java.lang.String dataName, java.lang.String id, java.lang.String format)
          Creates a new void type.
protected VoidType(java.lang.String typeName, java.lang.String dataName, java.lang.String id, java.util.Map metaData, boolean preserveNulls)
          Creates a new void type.
  VoidType(VoidType vt)
          Copy constructor.
 
Method Summary
 com.davisor.core.Dupable dup()
          Makes a deep copy of this object.
 java.lang.Class getValueClass()
          Gets value container class.
static boolean isVoidType(Type type)
          Tests if given type is a pure instance of VoidType class, without any sub-classes.
 boolean preserveNulls()
          Tests if this type instance keeps or converts null values.
 void preserveNulls(boolean preserveNulls)
          Sets if this type instance keeps or converts null values.
 DataValue toData(java.sql.CallableStatement statement, int column)
          Converts a callable statement variable to 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.Type
ceil, check, check, compare, create, create, create, create, create, dup, equals, floor, format, getCompatibility, getDataName, getFormat, getId, getID, getMetaData, getMetaData, getSpecs, getSQLCode, 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 VoidType DEFAULT
Default void type.


TYPENAME

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

See Also:
Constant Field Values

M_preserveNulls

protected boolean M_preserveNulls
Keep or convert null values (default: convert).

Constructor Detail

VoidType

public VoidType()
Default constructor.


VoidType

public VoidType(VoidType vt)
Copy constructor.


VoidType

public VoidType(java.lang.String dataName,
                java.lang.String id,
                java.lang.String format)
Creates a new void 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 (ignored)

VoidType

public VoidType(java.lang.String dataName,
                java.lang.String id,
                java.util.Map metaData,
                boolean preserveNulls)
Creates a new void type instance.

Parameters:
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

VoidType

protected VoidType(java.lang.String typeName,
                   java.lang.String dataName,
                   java.lang.String id,
                   java.util.Map metaData,
                   boolean preserveNulls)
Creates a new void 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
Specified by:
dup in class Type

isVoidType

public static boolean isVoidType(Type type)
Tests if given type is a pure instance of VoidType class, without any sub-classes.


preserveNulls

public boolean preserveNulls()
Tests if this type instance keeps or converts null values.

Returns:
true if null values are preserved

preserveNulls

public void preserveNulls(boolean preserveNulls)
Sets if this type instance keeps or converts null values.

Parameters:
preserveNulls - true if null values are to be preserved, false if they are to be converted to appropriate data value object instances

getValueClass

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

Specified by:
getValueClass in class Type

toData

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

The given statement is ignored, and a null or VoidValue value is always returned.

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

toData

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

Given object is ignored, and a null or VoidValue value is always returned.

Overrides:
toData in class Type
Parameters:
objectValue - data object
Returns:
null or VoidValue value
Throws:
InvalidDataException - if given object value could not be parsed
See Also:
preserveNulls(), toData(CallableStatement,int), toData(ResultSet,int), toData(String,ParsePosition), VoidValue

toData

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

Given string and status are ignored, and a null or VoidValue value is always returned.

Specified by:
toData in class Type
Parameters:
stringValue - data string
status - parse status (may be null)
Returns:
null or VoidValue value
Throws:
InvalidDataException - if given string value could not be parsed
See Also:
preserveNulls(), toData(CallableStatement,int), toData(Object), toData(ResultSet,int), VoidValue

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.

Statement is ignored, and a null or VoidValue value is always returned.

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

zero

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

Specified by:
zero in class Type
Returns:
a new VoidValue value
See Also:
DataValue.deinterpolate(com.davisor.data.DataValue, com.davisor.data.DataValue), DataValue.interpolate(double, com.davisor.data.DataValue)


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