org.axiondb.types
Class VarBinaryType

java.lang.Object
  extended by org.axiondb.types.BaseDataType
      extended by org.axiondb.types.VarBinaryType
All Implemented Interfaces:
java.io.Serializable, java.util.Comparator, DataType, DataType.NonFixedPrecision, DataTypeFactory

public class VarBinaryType
extends BaseDataType
implements java.io.Serializable, java.util.Comparator, DataType.NonFixedPrecision

A DataTyperepresenting a BinaryArrayvalue.

Version:
$Revision: 1.9 $ $Date: 2005/11/03 01:26:57 $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.axiondb.DataType
DataType.BinaryRepresentation, DataType.ExactNumeric, DataType.NonFixedPrecision
 
Constructor Summary
VarBinaryType()
           
VarBinaryType(int length)
          Creates a new instance of VarBinaryType
 
Method Summary
 boolean accepts(java.lang.Object value)
          Return true if a field of my type can be assigned the given non- null value , false otherwise.
 int compare(java.lang.Object a, java.lang.Object b)
           
 java.lang.Object convert(java.lang.Object value)
          Converts an acceptablevalue to one of the appropriate type.
 int getColumnDisplaySize()
          Value returned by ResultSetMetaData#getColumnDisplaySizefor this data type.
 java.util.Comparator getComparator()
          This base implementation simply returns a ComparableComparator.
 int getJdbcType()
          Returns Types.VARBINARY.
 int getPrecision()
          Value returned by ResultSetMetaData#getPrecisionfor this data type.
 DataType makeNewInstance()
          Creates a new instance of this DataType implementation.
 java.lang.Object read(java.io.DataInput in)
          Instantiate an object of my type from the given DataInput.
 void setLength(int length)
           
 void setPrecision(int newSize)
          Overrides the default precision with the given value.
 java.lang.Object successor(java.lang.Object value)
          Returns the successor for the given value.
 boolean supportsSuccessor()
          Returns true if the DataType.successor(java.lang.Object)method is supported, false otherwise.
 byte[] toByteArray(java.lang.Object value)
          Convert the given non- null value to a byte[], or throw a AxionException.
 java.lang.String toString(java.lang.Object value)
          Convert the given non- null value to a String, or throw a AxionException.
 void write(java.lang.Object value, java.io.DataOutput out)
          Write an object of my type to the given DataOutput.
 
Methods inherited from class org.axiondb.types.BaseDataType
getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecisionRadix, getPreferredValueClassName, getScale, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, toBigDecimal, toBigInteger, toBlob, toBoolean, toByte, toClob, toDate, toDouble, toFloat, toInt, toLong, toNumber, toShort, toTime, toTimestamp, toURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axiondb.DataType
getLiteralPrefix, getLiteralSuffix, getNullableCode, getPrecisionRadix, getPreferredValueClassName, getScale, getSearchableCode, isCaseSensitive, isCurrency, isUnsigned, toBigDecimal, toBigInteger, toBlob, toBoolean, toByte, toClob, toDate, toDouble, toFloat, toInt, toLong, toShort, toTime, toTimestamp, toURL
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

VarBinaryType

public VarBinaryType()

VarBinaryType

public VarBinaryType(int length)
Creates a new instance of VarBinaryType

Method Detail

setLength

public void setLength(int length)

getColumnDisplaySize

public int getColumnDisplaySize()
Description copied from interface: DataType
Value returned by ResultSetMetaData#getColumnDisplaySizefor this data type.

Specified by:
getColumnDisplaySize in interface DataType
Overrides:
getColumnDisplaySize in class BaseDataType
See Also:
ResultSetMetaData.getColumnDisplaySize(int)

getPrecision

public int getPrecision()
Description copied from interface: DataType
Value returned by ResultSetMetaData#getPrecisionfor this data type.

Specified by:
getPrecision in interface DataType
Overrides:
getPrecision in class BaseDataType
See Also:
ResultSetMetaData.getPrecision(int)

accepts

public boolean accepts(java.lang.Object value)
Return true if a field of my type can be assigned the given non- null value , false otherwise.

Specified by:
accepts in interface DataType
Specified by:
accepts in class BaseDataType
Parameters:
value - non- null value

supportsSuccessor

public boolean supportsSuccessor()
Description copied from interface: DataType
Returns true if the DataType.successor(java.lang.Object)method is supported, false otherwise.

Specified by:
supportsSuccessor in interface DataType
Overrides:
supportsSuccessor in class BaseDataType

successor

public java.lang.Object successor(java.lang.Object value)
                           throws java.lang.IllegalArgumentException
Description copied from interface: DataType
Returns the successor for the given value. For example, the successor of the integer 1 is 2.

Specified by:
successor in interface DataType
Overrides:
successor in class BaseDataType
Throws:
java.lang.IllegalArgumentException

convert

public java.lang.Object convert(java.lang.Object value)
                         throws AxionException
Converts an acceptablevalue to one of the appropriate type.

Specified by:
convert in interface DataType
Specified by:
convert in class BaseDataType
Throws:
AxionException

toByteArray

public byte[] toByteArray(java.lang.Object value)
                   throws AxionException
Description copied from interface: DataType
Convert the given non- null value to a byte[], or throw a AxionException.

Specified by:
toByteArray in interface DataType
Overrides:
toByteArray in class BaseDataType
Throws:
AxionException
See Also:
ResultSet.getBytes(int)

getJdbcType

public int getJdbcType()
Returns Types.VARBINARY.

Specified by:
getJdbcType in interface DataType
Specified by:
getJdbcType in class BaseDataType

makeNewInstance

public DataType makeNewInstance()
Description copied from interface: DataType
Creates a new instance of this DataType implementation.

Specified by:
makeNewInstance in interface DataType
Specified by:
makeNewInstance in interface DataTypeFactory
Specified by:
makeNewInstance in class BaseDataType
Returns:
new instance of this DataType implementation.

read

public java.lang.Object read(java.io.DataInput in)
                      throws java.io.IOException
Instantiate an object of my type from the given DataInput. The next sequence of bytes to be read from the DataInput will have been written by write(java.lang.Object, java.io.DataOutput).

Specified by:
read in interface DataType
Specified by:
read in class BaseDataType
Parameters:
in - DataInput from which to read data
Throws:
java.io.IOException - if error occurs during read

write

public void write(java.lang.Object value,
                  java.io.DataOutput out)
           throws java.io.IOException
Write an object of my type to the given DataOutput.

Specified by:
write in interface DataType
Specified by:
write in class BaseDataType
Parameters:
value - the value to write, which must be acceptableto this DataType
out - DataOutput to receive data
Throws:
java.io.IOException - if error occurs while writing value, or if value is invalid for this type

toString

public java.lang.String toString(java.lang.Object value)
Description copied from interface: DataType
Convert the given non- null value to a String, or throw a AxionException.

Specified by:
toString in interface DataType
Overrides:
toString in class BaseDataType
See Also:
ResultSet.getString(int)

getComparator

public java.util.Comparator getComparator()
Description copied from class: BaseDataType
This base implementation simply returns a ComparableComparator.

Overrides:
getComparator in class BaseDataType

compare

public int compare(java.lang.Object a,
                   java.lang.Object b)
            throws java.lang.ClassCastException
Specified by:
compare in interface java.util.Comparator
Overrides:
compare in class BaseDataType
Throws:
java.lang.ClassCastException

setPrecision

public void setPrecision(int newSize)
Description copied from interface: DataType.NonFixedPrecision
Overrides the default precision with the given value.

Specified by:
setPrecision in interface DataType.NonFixedPrecision
Parameters:
newSize - new precision value. The appropriate value depends on the precision radix, which is fixed for each implementing type.