Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.types
Class JSQLType  view JSQLType download JSQLType.java

java.lang.Object
  extended byorg.apache.derby.iapi.types.JSQLType
All Implemented Interfaces:
java.io.Externalizable, org.apache.derby.iapi.services.io.Formatable, java.io.Serializable, org.apache.derby.iapi.services.io.TypedFormat

public final class JSQLType
extends java.lang.Object
implements org.apache.derby.iapi.services.io.Formatable

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


Field Summary
static byte BOOLEAN
           
static byte BYTE
           
private  byte category
           
static byte CHAR
           
static byte DOUBLE
           
static byte FLOAT
           
static byte INT
           
static byte JAVA_CLASS
           
static byte JAVA_PRIMITIVE
           
private  java.lang.String javaClassName
           
static byte LONG
           
static byte NOT_PRIMITIVE
           
private  byte primitiveKind
           
static java.lang.String[] primitiveNames
           
static byte SHORT
           
private  DataTypeDescriptor sqlType
           
static byte SQLTYPE
           
private static java.lang.String[] wrapperClassNames
           
 
Constructor Summary
JSQLType()
          Public 0-arg constructor for Formatable machinery.
JSQLType(byte primitiveKind)
          Create a JSQLType for a Java primitive.
JSQLType(DataTypeDescriptor sqlType)
          Create a JSQLType from a SQL type.
JSQLType(java.lang.String javaName)
          Create a JSQLType given the name of a Java primitive or java class.
 
Method Summary
 byte getCategory()
          What kind of type is this:
 java.lang.String getJavaClassName()
          If this is a JAVA_CLASS, what is it's name?
private static byte getPrimitiveID(java.lang.String name)
          Translate the name of a java primitive to an id
 byte getPrimitiveKind()
          If this is a JAVA_PRIMITIVE, what is its name?
 DataTypeDescriptor getSQLType()
          What's our SQLTYPE?
 int getTypeFormatId()
          Get the formatID which corresponds to this class.
private static java.lang.String getWrapperClassName(byte primitive)
          Gets the name of the java wrapper class corresponding to a primitive.
private  void initialize(byte primitiveKind)
           
private  void initialize(byte category, DataTypeDescriptor sqlType, java.lang.String javaClassName, byte primitiveKind)
          Initialize this JSQL type.
private  void initialize(DataTypeDescriptor sqlType)
           
private  void initialize(java.lang.String javaClassName)
           
 void readExternal(java.io.ObjectInput in)
          This method restores an object's state by reading in the instance data for the object from the passed in stream.
 void writeExternal(java.io.ObjectOutput out)
          This method is responsible for writing the instance data of an object to the passed in stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQLTYPE

public static final byte SQLTYPE
See Also:
Constant Field Values

JAVA_CLASS

public static final byte JAVA_CLASS
See Also:
Constant Field Values

JAVA_PRIMITIVE

public static final byte JAVA_PRIMITIVE
See Also:
Constant Field Values

NOT_PRIMITIVE

public static final byte NOT_PRIMITIVE
See Also:
Constant Field Values

BOOLEAN

public static final byte BOOLEAN
See Also:
Constant Field Values

CHAR

public static final byte CHAR
See Also:
Constant Field Values

BYTE

public static final byte BYTE
See Also:
Constant Field Values

SHORT

public static final byte SHORT
See Also:
Constant Field Values

INT

public static final byte INT
See Also:
Constant Field Values

LONG

public static final byte LONG
See Also:
Constant Field Values

FLOAT

public static final byte FLOAT
See Also:
Constant Field Values

DOUBLE

public static final byte DOUBLE
See Also:
Constant Field Values

wrapperClassNames

private static final java.lang.String[] wrapperClassNames

primitiveNames

public static final java.lang.String[] primitiveNames

category

private byte category

sqlType

private DataTypeDescriptor sqlType

javaClassName

private java.lang.String javaClassName

primitiveKind

private byte primitiveKind
Constructor Detail

JSQLType

public JSQLType()
Public 0-arg constructor for Formatable machinery.


JSQLType

public JSQLType(DataTypeDescriptor sqlType)
Create a JSQLType from a SQL type.


JSQLType

public JSQLType(java.lang.String javaName)
Create a JSQLType given the name of a Java primitive or java class.


JSQLType

public JSQLType(byte primitiveKind)
Create a JSQLType for a Java primitive.

Method Detail

getCategory

public byte getCategory()
What kind of type is this:


getPrimitiveKind

public byte getPrimitiveKind()
If this is a JAVA_PRIMITIVE, what is its name?


getJavaClassName

public java.lang.String getJavaClassName()
If this is a JAVA_CLASS, what is it's name?


getSQLType

public DataTypeDescriptor getSQLType()
What's our SQLTYPE?


getTypeFormatId

public int getTypeFormatId()
Get the formatID which corresponds to this class.

Specified by:
getTypeFormatId in interface org.apache.derby.iapi.services.io.TypedFormat

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Description copied from interface: java.io.Externalizable
This method restores an object's state by reading in the instance data for the object from the passed in stream. Note that this stream is not a subclass of InputStream, but rather is a class that implements the ObjectInput interface. That interface provides a mechanism for reading in Java data types from a stream.

Note that this method must be compatible with writeExternal. It must read back the exact same types that were written by that method in the exact order they were written.

If this method needs to read back an object instance, then the class for that object must be found and loaded. If that operation fails, then this method throws a ClassNotFoundException

Specified by:
readExternal in interface java.io.Externalizable

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Description copied from interface: java.io.Externalizable
This method is responsible for writing the instance data of an object to the passed in stream. Note that this stream is not a subclass of OutputStream, but rather is a class that implements the ObjectOutput interface. That interface provides a number of methods for writing Java data values to a stream.

Not that the implementation of this method must be coordinated with the implementation of readExternal.

Specified by:
writeExternal in interface java.io.Externalizable

initialize

private void initialize(byte primitiveKind)

initialize

private void initialize(DataTypeDescriptor sqlType)

initialize

private void initialize(java.lang.String javaClassName)

initialize

private void initialize(byte category,
                        DataTypeDescriptor sqlType,
                        java.lang.String javaClassName,
                        byte primitiveKind)
Initialize this JSQL type. Minion of all constructors.


getWrapperClassName

private static java.lang.String getWrapperClassName(byte primitive)
Gets the name of the java wrapper class corresponding to a primitive.


getPrimitiveID

private static byte getPrimitiveID(java.lang.String name)
Translate the name of a java primitive to an id