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

public final Class JSQLType

extends Object
implements Formatable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.io.Formatable, org.apache.derby.iapi.services.io.TypedFormat, java.io.Externalizable, java.io.Serializable
Imports
org.apache.derby.iapi.services.io.StoredFormatIds, .Formatable, org.apache.derby.shared.common.error.StandardException, java.io.IOException, .ObjectInput, .ObjectOutput

Type descriptor which wraps all 3 kinds of types supported in Derby's JSQL language: SQL types, Java primitives, Java classes. This interface was originally added to support the serializing of WorkUnit signatures.

Field Summary

Modifier and TypeField and Description
public static final byte
public static final byte
private byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
public static final byte
private String
public static final byte
public static final byte
private byte
private static final String[]
public static final byte
public static final byte
private DataTypeDescriptor
private static final String[]

Constructor Summary

AccessConstructor and Description
public
JSQLType()

Public 0-arg constructor for Formatable machinery.

public
JSQLType(DataTypeDescriptor
the SQL type to wrap
sqlType
)

Create a JSQLType from a SQL type.

public
JSQLType(String
name of java primitive or class to wrap
javaName
)

Create a JSQLType given the name of a Java primitive or java class.

public
JSQLType(byte
primitive to wrap
primitiveKind
)

Create a JSQLType for a Java primitive.

Method Summary

Modifier and TypeMethod and Description
public byte

Returns:

one of the following: SQLTYPE, JAVA_PRIMITIVE, JAVA_CLASS
getCategory
()

What kind of type is this:

public String

Returns:

java class name if this is a JAVA_CLASS null if this is SQLTYPE or JAVA_PRIMITIVE
getJavaClassName
()

If this is a JAVA_CLASS, what is it's name?

public static byte

Returns:

BOOLEAN, INT, ... etc if the name is that of a primitive. NOT_PRIMITIVE otherwise
getPrimitiveID
(String
name of primitive
name
)

Translate the name of a java primitive to an id

public byte

Returns:

BOOLEAN, INT, ... if this is a JAVA_PRIMITIVE. NOT_PRIMITIVE if this is SQLTYPE or JAVA_CLASS.
getPrimitiveKind
()

If this is a JAVA_PRIMITIVE, what is its name?

public static String
getPrimitiveName(byte index)

public DataTypeDescriptor

Returns:

the DataTypeDescriptor corresponding to this type
getSQLType
()

What's our SQLTYPE?

public int

Returns:

the formatID of this class
getTypeFormatId
()

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

Get the formatID which corresponds to this class.

public static String

Returns:

name of the java wrapper class corresponding to the primitive
getWrapperClassName
(byte
BOOLEAN, INT, ... etc.
primitive
)

Gets the name of the java wrapper class corresponding to a primitive.

private void
initialize(byte primitiveKind)

private void
private void
initialize(String javaClassName)

private void
initialize(byte
SQLTYPE, JAVA_CLASS, JAVA_PRIMITIVE
category
,
DataTypeDescriptor
corresponding SQL type if category=SQLTYPE
sqlType
,
String
corresponding java class if category=JAVA_CLASS
javaClassName
,
byte
kind of primitive if category=JAVA_PRIMITIVE
primitiveKind
)

Initialize this JSQL type.

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
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 java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BOOLEANback to summary
public static final byte BOOLEAN
BYTEback to summary
public static final byte BYTE
categoryback to summary
private byte category
CHARback to summary
public static final byte CHAR
DOUBLEback to summary
public static final byte DOUBLE
FLOATback to summary
public static final byte FLOAT
INTback to summary
public static final byte INT
JAVA_CLASSback to summary
public static final byte JAVA_CLASS
JAVA_PRIMITIVEback to summary
public static final byte JAVA_PRIMITIVE
javaClassNameback to summary
private String javaClassName
LONGback to summary
public static final byte LONG
NOT_PRIMITIVEback to summary
public static final byte NOT_PRIMITIVE
primitiveKindback to summary
private byte primitiveKind
primitiveNamesback to summary
private static final String[] primitiveNames
SHORTback to summary
public static final byte SHORT
SQLTYPEback to summary
public static final byte SQLTYPE
sqlTypeback to summary
private DataTypeDescriptor sqlType
wrapperClassNamesback to summary
private static final String[] wrapperClassNames

Constructor Detail

JSQLTypeback to summary
public JSQLType()

Public 0-arg constructor for Formatable machinery.

JSQLTypeback to summary
public JSQLType(DataTypeDescriptor sqlType)

Create a JSQLType from a SQL type.

Parameters
sqlType:DataTypeDescriptor

the SQL type to wrap

JSQLTypeback to summary
public JSQLType(String javaName)

Create a JSQLType given the name of a Java primitive or java class.

Parameters
javaName:String

name of java primitive or class to wrap

JSQLTypeback to summary
public JSQLType(byte primitiveKind)

Create a JSQLType for a Java primitive.

Parameters
primitiveKind:byte

primitive to wrap

Method Detail

getCategoryback to summary
public byte getCategory()

What kind of type is this:

Returns:byte

one of the following: SQLTYPE, JAVA_PRIMITIVE, JAVA_CLASS

getJavaClassNameback to summary
public String getJavaClassName()

If this is a JAVA_CLASS, what is it's name?

Returns:String

java class name if this is a JAVA_CLASS null if this is SQLTYPE or JAVA_PRIMITIVE

getPrimitiveIDback to summary
public static byte getPrimitiveID(String name)

Translate the name of a java primitive to an id

Parameters
name:String

name of primitive

Returns:byte

BOOLEAN, INT, ... etc if the name is that of a primitive. NOT_PRIMITIVE otherwise

getPrimitiveKindback to summary
public byte getPrimitiveKind()

If this is a JAVA_PRIMITIVE, what is its name?

Returns:byte

BOOLEAN, INT, ... if this is a JAVA_PRIMITIVE. NOT_PRIMITIVE if this is SQLTYPE or JAVA_CLASS.

getPrimitiveNameback to summary
public static String getPrimitiveName(byte index)
getSQLTypeback to summary
public DataTypeDescriptor getSQLType() throws StandardException

What's our SQLTYPE?

Returns:DataTypeDescriptor

the DataTypeDescriptor corresponding to this type

getTypeFormatIdback to summary
public int getTypeFormatId()

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

Get the formatID which corresponds to this class.

Returns:int

the formatID of this class

getWrapperClassNameback to summary
public static String getWrapperClassName(byte primitive)

Gets the name of the java wrapper class corresponding to a primitive.

Parameters
primitive:byte

BOOLEAN, INT, ... etc.

Returns:String

name of the java wrapper class corresponding to the primitive

initializeback to summary
private void initialize(byte primitiveKind)
initializeback to summary
private void initialize(DataTypeDescriptor sqlType)
initializeback to summary
private void initialize(String javaClassName)
initializeback to summary
private void initialize(byte category, DataTypeDescriptor sqlType, String javaClassName, byte primitiveKind)

Initialize this JSQL type. Minion of all constructors.

Parameters
category:byte

SQLTYPE, JAVA_CLASS, JAVA_PRIMITIVE

sqlType:DataTypeDescriptor

corresponding SQL type if category=SQLTYPE

javaClassName:String

corresponding java class if category=JAVA_CLASS

primitiveKind:byte

kind of primitive if category=JAVA_PRIMITIVE

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
ClassNotFoundException:
thrown on error
See Also
java.io.Externalizable#readExternal
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:
thrown on error