Top Description Fields Constructors Methods
org.apache.derby.iapi.types

public Class UserType

extends DataType
implements UserDataValue
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.types.UserDataValue, org.apache.derby.iapi.types.DataValueDescriptor, org.apache.derby.iapi.types.Orderable, org.apache.derby.iapi.services.io.Storable, org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Known Direct Subclasses
org.apache.derby.impl.store.access.UTF
Imports
org.apache.derby.catalog.TypeDescriptor, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.loader.ClassInspector, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.services.io.StoredFormatIds, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.cache.ClassSize, java.sql.Date, .Time, .Timestamp, .ResultSet, .SQLException, java.io.ObjectOutput, .ObjectInput, .IOException, java.math.BigDecimal, java.util.Calendar

This contains an instance of a user-defined type, that is, a java object.

Field Summary

Modifier and TypeField and Description
private static final int
private Object

Constructor Summary

AccessConstructor and Description
public
UserType()

no-arg constructor required by Formattable

public

Method Summary

Modifier and TypeMethod and Description
public DataValueDescriptor
cloneValue(boolean
any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false
forceMaterialization
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Clone this DataValueDescriptor.

public int
compare(DataValueDescriptor
The Orderable to compare this one to.
other
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Orderable interface

public boolean
compare(int
Orderable.ORDER_OP_EQUALS means do an = comparison. Orderable.ORDER_OP_LESSTHAN means compare this < other. Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.
op
,
DataValueDescriptor
The DataValueDescriptor to compare this one to.
other
,
boolean
True means to treat nulls as ordered values, that is, treat SQL null as equal to null, and less than all other values. False means to treat nulls as unknown values, that is, the result of any comparison with a null is the UNKNOWN truth value.
orderedNulls
,
boolean
The return value to use if the result of the comparison is the UNKNOWN truth value. In other words, if orderedNulls is false, and a null is involved in the comparison, return unknownRV. This parameter is not used orderedNulls is true.
unknownRV
)

Overrides org.apache.derby.iapi.types.DataType.compare.

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare this Orderable with a given Orderable for the purpose of qualification and sorting.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the two parameters are equal
equals
(DataValueDescriptor
The value on the left side of the =
left
,
DataValueDescriptor
The value on the right side of the =
right
)

Overrides org.apache.derby.iapi.types.DataType.equals.

Implements org.apache.derby.iapi.types.DataValueDescriptor.equals.

The = operator as called from the language module, as opposed to the storage module.

public int
estimateMemoryUsage()

Implements org.apache.derby.iapi.types.DataValueDescriptor.estimateMemoryUsage.

Estimate the memory usage in bytes of the data value and the overhead of the class.

public boolean
getBoolean()

Overrides org.apache.derby.iapi.types.DataType.getBoolean.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getBoolean.

Gets the value in the data value descriptor as a boolean.

public byte
getByte()

Overrides org.apache.derby.iapi.types.DataType.getByte.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getByte.

Gets the value in the data value descriptor as a byte.

public byte[]
getBytes()

Overrides org.apache.derby.iapi.types.DataType.getBytes.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getBytes.

Gets the value in the data value descriptor as a byte array.

public Date
getDate(Calendar
calendar for object creation
cal
)

Overrides org.apache.derby.iapi.types.DataType.getDate.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getDate.

Gets the value in the data value descriptor as a java.sql.Date.

public double
getDouble()

Overrides org.apache.derby.iapi.types.DataType.getDouble.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getDouble.

Gets the value in the data value descriptor as a double.

public float
getFloat()

Overrides org.apache.derby.iapi.types.DataType.getFloat.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getFloat.

Gets the value in the data value descriptor as a float.

public int
getInt()

Overrides org.apache.derby.iapi.types.DataType.getInt.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getInt.

Gets the value in the data value descriptor as an int.

public int
getLength()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getLength.

Gets the length of the data value.

public long
getLong()

Overrides org.apache.derby.iapi.types.DataType.getLong.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getLong.

Gets the value in the data value descriptor as a long.

public DataValueDescriptor
getNewNull()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

public Object
getObject()

Overrides org.apache.derby.iapi.types.DataType.getObject.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getObject.

Gets the value in the data value descriptor as a Java Object.

public short
getShort()

Overrides org.apache.derby.iapi.types.DataType.getShort.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getShort.

Gets the value in the data value descriptor as a short.

public String
getString()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getString.

Gets the value in the data value descriptor as a String.

public Time
getTime(Calendar
calendar for object creation
cal
)

Overrides org.apache.derby.iapi.types.DataType.getTime.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTime.

Gets the value in the data value descriptor as a java.sql.Time.

public Timestamp
getTimestamp(Calendar
calendar for object creation
cal
)

Overrides org.apache.derby.iapi.types.DataType.getTimestamp.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTimestamp.

Gets the value in the data value descriptor as a java.sql.Timestamp.

public int
public String
getTypeName()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Get the SQL name of the datatype

pack-priv String
getTypeName(String className)

Overrides org.apache.derby.iapi.types.DataType.getTypeName.

Get the type name of this value, overriding with the passed in class name (for user/java types).

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public final boolean

Returns:

Whether or not value is logically null.
isNull
()

Implements org.apache.derby.iapi.services.io.Storable.isNull.

Check if the value is null.

public BooleanDataValue

Returns:

A SQL boolean value telling whether the two parameters are not equal
notEquals
(DataValueDescriptor
The value on the left side of the operator
left
,
DataValueDescriptor
The value on the right side of the operator
right
)

Overrides org.apache.derby.iapi.types.DataType.notEquals.

Implements org.apache.derby.iapi.types.DataValueDescriptor.notEquals.

The <> operator as called from the language module, as opposed to the storage module.

public void
readExternal(ObjectInput
the stream to read data from in order to restore the object
in
)

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

public void
restoreToNull()

Implements org.apache.derby.iapi.services.io.Storable.restoreToNull.

Restore this object to its (SQL)null value.

public void
setBigDecimal(BigDecimal
required to be a BigDecimal or null.
theValue
)

Overrides org.apache.derby.iapi.types.DataType.setBigDecimal.

Implements org.apache.derby.iapi.types.DataValueDescriptor.setBigDecimal.

Set this value from an application supplied java.math.BigDecimal.

protected void
setFrom(DataValueDescriptor
The DataValueDescriptor that holds the value to which we want to set this DataValueDescriptor's value.
theValue
)

Overrides org.apache.derby.iapi.types.DataType.setFrom.

Set the value of this DataValueDescriptor based on the value of the specified DataValueDescriptor.

pack-priv void
setObject(Object theValue)

Overrides org.apache.derby.iapi.types.DataType.setObject.

Set the value from an non-null object.

public void
setValue(Object
The value to set this UserDataValue to
value
)

Overrides org.apache.derby.iapi.types.DataType.setValue.

Implements org.apache.derby.iapi.types.UserDataValue.setValue, org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this UserDataValue to the given Object

public void
setValue(String
The String value to set this DataValueDescriptor to
theValue
)

Overrides org.apache.derby.iapi.types.DataType.setValue.

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

public void
setValueFromResultSet(ResultSet
The specified ResultSet.
resultSet
,
int
The 1-based column # into the resultSet.
colNumber
,
boolean
Whether or not the column is nullable (No need to call wasNull() if not)
isNullable
)

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValueFromResultSet.

Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public int
public void
writeExternal(ObjectOutput
the stream to write the object to
out
)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Inherited from org.apache.derby.iapi.types.DataType:
checkHostVariablecloneHoldercoalescecomparecomparecompareTodataTypeConversionequalsflipgenericSetObjectgetStreamgetTraceStringgreaterOrEqualsgreaterThanhasStreamininvalidFormatisNotNullisNullOplessOrEqualslessThannormalizeoutOfRangereadExternalFromArrayrecyclesetIntosetIntosetObjectForCastsetToNullsetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuethrowLangSetMismatchthrowLangSetMismatchtypeToBigDecimal

Field Detail

BASE_MEMORY_USAGEback to summary
private static final int BASE_MEMORY_USAGE
valueback to summary
private Object value

Constructor Detail

UserTypeback to summary
public UserType()

no-arg constructor required by Formattable

UserTypeback to summary
public UserType(Object value)

Method Detail

cloneValueback to summary
public DataValueDescriptor cloneValue(boolean forceMaterialization)

Implements org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.cloneValue.

Clone this DataValueDescriptor. Results in a new object that has the same value as this but can be modified independently.

Even though the objects can be modified independently regardless of the value of forceMaterialization, both the clone and the original may be dependent on the store state if forceMaterialization is set to false. An example is if you need to access the value you just read using cloneValue after the current transaction has ended, or after the source result set has been closed.

Parameters
forceMaterialization:boolean

any streams representing the data value will be materialized if true, the data value will be kept as a stream if possible if false

Returns:DataValueDescriptor

A clone of the DataValueDescriptor with the same initial value as this.

See Also
DataValueDescriptor#cloneValue
compareback to summary
public int compare(DataValueDescriptor other) throws StandardException

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Orderable interface

Parameters
other:DataValueDescriptor

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

The Orderable to compare this one to.

Returns:int

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

<0 - this Orderable is less than other. 0 - this Orderable equals other. >0 - this Orderable is greater than other. The code should not explicitly look for -1, or 1.

Annotations
@SuppressWarnings:unchecked
Exceptions
StandardException:
thrown on failure
See Also
org.apache.derby.iapi.types.Orderable
compareback to summary
public boolean compare(int op, DataValueDescriptor other, boolean orderedNulls, boolean unknownRV) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.compare.

Implements org.apache.derby.iapi.types.DataValueDescriptor.compare.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.compare.

Compare this Orderable with a given Orderable for the purpose of qualification and sorting. The caller gets to determine how nulls should be treated - they can either be ordered values or unknown values.

Parameters
op:int

Orderable.ORDER_OP_EQUALS means do an = comparison. Orderable.ORDER_OP_LESSTHAN means compare this < other. Orderable.ORDER_OP_LESSOREQUALS means compare this <= other.

other:DataValueDescriptor

The DataValueDescriptor to compare this one to.

orderedNulls:boolean

True means to treat nulls as ordered values, that is, treat SQL null as equal to null, and less than all other values. False means to treat nulls as unknown values, that is, the result of any comparison with a null is the UNKNOWN truth value.

unknownRV:boolean

The return value to use if the result of the comparison is the UNKNOWN truth value. In other words, if orderedNulls is false, and a null is involved in the comparison, return unknownRV. This parameter is not used orderedNulls is true.

Returns:boolean

true if the comparison is true (duh!)

Exceptions
StandardException:
thrown on error
equalsback to summary
public BooleanDataValue equals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.equals.

Implements org.apache.derby.iapi.types.DataValueDescriptor.equals.

The = operator as called from the language module, as opposed to the storage module.

Parameters
left:DataValueDescriptor

The value on the left side of the =

right:DataValueDescriptor

The value on the right side of the =

Returns:BooleanDataValue

A SQL boolean value telling whether the two parameters are equal

Exceptions
StandardException:
Thrown on error
estimateMemoryUsageback to summary
public int estimateMemoryUsage()

Implements org.apache.derby.iapi.types.DataValueDescriptor.estimateMemoryUsage.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.estimateMemoryUsage.

Estimate the memory usage in bytes of the data value and the overhead of the class.

Returns:int

the estimated memory usage

getBooleanback to summary
public boolean getBoolean() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getBoolean.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getBoolean.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getBoolean.

Gets the value in the data value descriptor as a boolean. Throws an exception if the data value is not a boolean. For DataValueDescriptor, this is the preferred interface for BIT, but for this no-casting interface, it isn't, because BIT is stored internally as a Bit, not as a Boolean.

Returns:boolean

The data value as a boolean.

Exceptions
StandardException:
thrown on failure to convert
getByteback to summary
public byte getByte() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getByte.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getByte.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getByte.

Gets the value in the data value descriptor as a byte. Throws an exception if the data value is not a byte.

Returns:byte

The data value as a byte.

Exceptions
StandardException:
thrown on failure to convert
getBytesback to summary
public byte[] getBytes() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getBytes.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getBytes.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getBytes.

Gets the value in the data value descriptor as a byte array. Throws an exception if the data value is not a byte array.

Returns:byte[]

The data value as a byte[].

Exceptions
StandardException:
thrown on failure to convert
getDateback to summary
public Date getDate(Calendar cal) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getDate.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getDate.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getDate.

Gets the value in the data value descriptor as a java.sql.Date. Throws an exception if the data value is not a Date.

Parameters
cal:Calendar

calendar for object creation

Returns:Date

The data value as a java.sql.Date.

Exceptions
StandardException:
thrown on failure
getDoubleback to summary
public double getDouble() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getDouble.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getDouble.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getDouble.

Gets the value in the data value descriptor as a double. Throws an exception if the data value is not a double.

Returns:double

The data value as a double.

Exceptions
StandardException:
thrown on failure to convert
getFloatback to summary
public float getFloat() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getFloat.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getFloat.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getFloat.

Gets the value in the data value descriptor as a float. Throws an exception if the data value is not a float.

Returns:float

The data value as a float.

Exceptions
StandardException:
thrown on failure to convert
getIntback to summary
public int getInt() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getInt.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getInt.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getInt.

Gets the value in the data value descriptor as an int. Throws an exception if the data value is not an int.

Returns:int

The data value as a int.

Exceptions
StandardException:
thrown on failure to convert
getLengthback to summary
public int getLength()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getLength.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getLength.

Gets the length of the data value. The meaning of this is implementation-dependent. For string types, it is the number of characters in the string. For numeric types, it is the number of bytes used to store the number. This is the actual length of this value, not the length of the type it was defined as. For example, a VARCHAR value may be shorter than the declared VARCHAR (maximum) length.

Returns:int

The length of the data value

getLongback to summary
public long getLong() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getLong.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getLong.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getLong.

Gets the value in the data value descriptor as a long. Throws an exception if the data value is not a long.

Returns:long

The data value as a long.

Exceptions
StandardException:
thrown on failure to convert
getNewNullback to summary
public DataValueDescriptor getNewNull()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getNewNull.

Get a new null value of the same type as this data value.

See Also
DataValueDescriptor#getNewNull
getObjectback to summary
public Object getObject()

Overrides org.apache.derby.iapi.types.DataType.getObject.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getObject.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getObject.

Gets the value in the data value descriptor as a Java Object. The type of the Object will be the Java object type corresponding to the data value's SQL type. JDBC defines a mapping between Java object types and SQL types - we will allow that to be extended through user type definitions. Throws an exception if the data value is not an object (yeah, right).

Returns:Object

The data value as an Object.

getShortback to summary
public short getShort() throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getShort.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getShort.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getShort.

Gets the value in the data value descriptor as a short. Throws an exception if the data value is not a short.

Returns:short

The data value as a short.

Exceptions
StandardException:
thrown on failure to convert
getStringback to summary
public String getString()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getString.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getString.

Gets the value in the data value descriptor as a String. Throws an exception if the data value is not a string.

Returns:String

The data value as a String.

getTimeback to summary
public Time getTime(Calendar cal) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getTime.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTime.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getTime.

Gets the value in the data value descriptor as a java.sql.Time. Throws an exception if the data value is not a Time.

Parameters
cal:Calendar

calendar for object creation

Returns:Time

The data value as a java.sql.Time.

Exceptions
StandardException:
thrown on failure
getTimestampback to summary
public Timestamp getTimestamp(Calendar cal) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.getTimestamp.

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTimestamp.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getTimestamp.

Gets the value in the data value descriptor as a java.sql.Timestamp. Throws an exception if the data value is not a Timestamp.

Parameters
cal:Calendar

calendar for object creation

Returns:Timestamp

The data value as a java.sql.Timestamp.

Exceptions
StandardException:
thrown on failure
getTypeFormatIdback to summary
public int getTypeFormatId()

Implements org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

Return my format identifier.

Returns:int

Doc from org.apache.derby.iapi.services.io.TypedFormat.getTypeFormatId.

The identifier. (A UUID stuffed in an array of 16 bytes).

See Also
org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId
getTypeNameback to summary
public String getTypeName()

Implements org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.getTypeName.

Get the SQL name of the datatype

Returns:String

The SQL name of the datatype

getTypeNameback to summary
pack-priv String getTypeName(String className)

Overrides org.apache.derby.iapi.types.DataType.getTypeName.

Get the type name of this value, overriding with the passed in class name (for user/java types).

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

isNullback to summary
public final boolean isNull()

Implements org.apache.derby.iapi.services.io.Storable.isNull.

Check if the value is null.

Returns:boolean

Whether or not value is logically null.

notEqualsback to summary
public BooleanDataValue notEquals(DataValueDescriptor left, DataValueDescriptor right) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.notEquals.

Implements org.apache.derby.iapi.types.DataValueDescriptor.notEquals.

The <> operator as called from the language module, as opposed to the storage module.

Parameters
left:DataValueDescriptor

The value on the left side of the operator

right:DataValueDescriptor

The value on the right side of the operator

Returns:BooleanDataValue

A SQL boolean value telling whether the two parameters are not equal

Exceptions
StandardException:
Thrown on error
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Doc from java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Parameters
in:ObjectInput

the stream to read data from in order to restore the object

Exceptions
IOException:
Thrown on error reading the object
ClassNotFoundException:
Thrown if the class of the object is not found
See Also
java.io.Externalizable#readExternal
restoreToNullback to summary
public void restoreToNull()

Implements org.apache.derby.iapi.services.io.Storable.restoreToNull.

Doc from org.apache.derby.iapi.services.io.Storable.restoreToNull.

Restore this object to its (SQL)null value.

See Also
org.apache.derby.iapi.services.io.Storable#restoreToNull
setBigDecimalback to summary
public void setBigDecimal(BigDecimal theValue)

Overrides org.apache.derby.iapi.types.DataType.setBigDecimal.

Implements org.apache.derby.iapi.types.DataValueDescriptor.setBigDecimal.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.setBigDecimal.

Set this value from an application supplied java.math.BigDecimal. This is to support the PreparedStatement.setBigDecimal method and similar JDBC methods that allow an application to pass in a BigDecimal to any SQL type.

Parameters
theValue:BigDecimal

required to be a BigDecimal or null.

See Also
UserDataValue#setValue
setFromback to summary
protected void setFrom(DataValueDescriptor theValue) throws StandardException

Overrides org.apache.derby.iapi.types.DataType.setFrom.

Doc from org.apache.derby.iapi.types.DataType.setFrom.

Set the value of this DataValueDescriptor based on the value of the specified DataValueDescriptor.

Parameters
theValue:DataValueDescriptor

The DataValueDescriptor that holds the value to which we want to set this DataValueDescriptor's value.

setObjectback to summary
pack-priv void setObject(Object theValue)

Overrides org.apache.derby.iapi.types.DataType.setObject.

Doc from org.apache.derby.iapi.types.DataType.setObject.

Set the value from an non-null object. Usually overridden. This implementation throws an exception. The object will have been correctly typed from the call to setObjectForCast.

setValueback to summary
public void setValue(Object value)

Overrides org.apache.derby.iapi.types.DataType.setValue.

Implements org.apache.derby.iapi.types.UserDataValue.setValue, org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Doc from org.apache.derby.iapi.types.UserDataValue.setValue.

Set the value of this UserDataValue to the given Object

Parameters
value:Object

The value to set this UserDataValue to

See Also
UserDataValue#setValue
setValueback to summary
public void setValue(String theValue)

Overrides org.apache.derby.iapi.types.DataType.setValue.

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.setValue.

Set the value of this DataValueDescriptor.

Parameters
theValue:String

The String value to set this DataValueDescriptor to

setValueFromResultSetback to summary
public void setValueFromResultSet(ResultSet resultSet, int colNumber, boolean isNullable) throws SQLException

Implements org.apache.derby.iapi.types.DataValueDescriptor.setValueFromResultSet.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.setValueFromResultSet.

Set the value based on the value for the specified DataValueDescriptor from the specified ResultSet.

Parameters
resultSet:ResultSet

The specified ResultSet.

colNumber:int

The 1-based column # into the resultSet.

isNullable:boolean

Whether or not the column is nullable (No need to call wasNull() if not)

Exceptions
SQLException:
Thrown on error
See Also
DataValueDescriptor#setValueFromResultSet
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

typePrecedenceback to summary
public int typePrecedence()

Overrides org.apache.derby.iapi.types.DataType.typePrecedence.

Implements org.apache.derby.iapi.types.DataValueDescriptor.typePrecedence.

Doc from org.apache.derby.iapi.types.DataValueDescriptor.typePrecedence.

Each built-in type in JSQL has a precedence. This precedence determines how to do type promotion when using binary operators. For example, float has a higher precedence than int, so when adding an int to a float, the result type is float. The precedence for some types is arbitrary. For example, it doesn't matter what the precedence of the boolean type is, since it can't be mixed with other types. But the precedence for the number types is critical. The SQL standard requires that exact numeric types be promoted to approximate numeric when one operator uses both. Also, the precedence is arranged so that one will not lose precision when promoting a type.

Returns:int

The precedence of this type.

See Also
DataValueDescriptor#typePrecedence
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Doc from java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Parameters
out:ObjectOutput

the stream to write the object to

Exceptions
IOException:
error writing data