Package org.apache.derby.iapi.types
Class JSQLType
java.lang.Object
org.apache.derby.iapi.types.JSQLType
- All Implemented Interfaces:
Externalizable
,Serializable
,Formatable
,TypedFormat
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
static final byte
private byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
private String
static final byte
static final byte
private byte
private static final String[]
static final byte
private DataTypeDescriptor
static final byte
private static final String[]
-
Constructor Summary
ConstructorsConstructorDescriptionJSQLType()
Public 0-arg constructor for Formatable machinery.JSQLType
(byte primitiveKind) Create a JSQLType for a Java primitive.Create a JSQLType given the name of a Java primitive or java class.JSQLType
(DataTypeDescriptor sqlType) Create a JSQLType from a SQL type. -
Method Summary
Modifier and TypeMethodDescriptionbyte
What kind of type is this:If this is a JAVA_CLASS, what is it's name?static byte
getPrimitiveID
(String name) Translate the name of a java primitive to an idbyte
If this is a JAVA_PRIMITIVE, what is its name?static String
getPrimitiveName
(byte index) What's our SQLTYPE?int
Get the formatID which corresponds to this class.static 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, String javaClassName, byte primitiveKind) Initialize this JSQL type.private void
initialize
(String javaClassName) private void
initialize
(DataTypeDescriptor sqlType) void
void
-
Field Details
-
SQLTYPE
public static final byte SQLTYPE- See Also:
-
JAVA_CLASS
public static final byte JAVA_CLASS- See Also:
-
JAVA_PRIMITIVE
public static final byte JAVA_PRIMITIVE- See Also:
-
NOT_PRIMITIVE
public static final byte NOT_PRIMITIVE- See Also:
-
BOOLEAN
public static final byte BOOLEAN- See Also:
-
CHAR
public static final byte CHAR- See Also:
-
BYTE
public static final byte BYTE- See Also:
-
SHORT
public static final byte SHORT- See Also:
-
INT
public static final byte INT- See Also:
-
LONG
public static final byte LONG- See Also:
-
FLOAT
public static final byte FLOAT- See Also:
-
DOUBLE
public static final byte DOUBLE- See Also:
-
wrapperClassNames
-
primitiveNames
-
category
private byte category -
sqlType
-
javaClassName
-
primitiveKind
private byte primitiveKind
-
-
Constructor Details
-
JSQLType
public JSQLType()Public 0-arg constructor for Formatable machinery. -
JSQLType
Create a JSQLType from a SQL type.- Parameters:
sqlType
- the SQL type to wrap
-
JSQLType
Create a JSQLType given the name of a Java primitive or java class.- Parameters:
javaName
- name of java primitive or class to wrap
-
JSQLType
public JSQLType(byte primitiveKind) Create a JSQLType for a Java primitive.- Parameters:
primitiveKind
- primitive to wrap
-
-
Method Details
-
getCategory
public byte getCategory()What kind of type is this:- Returns:
- one of the following: SQLTYPE, JAVA_PRIMITIVE, JAVA_CLASS
-
getPrimitiveKind
public byte getPrimitiveKind()If this is a JAVA_PRIMITIVE, what is its name?- Returns:
- BOOLEAN, INT, ... if this is a JAVA_PRIMITIVE. NOT_PRIMITIVE if this is SQLTYPE or JAVA_CLASS.
-
getJavaClassName
If this is a JAVA_CLASS, what is it's name?- Returns:
- java class name if this is a JAVA_CLASS null if this is SQLTYPE or JAVA_PRIMITIVE
-
getSQLType
What's our SQLTYPE?- Returns:
- the DataTypeDescriptor corresponding to this type
- Throws:
StandardException
-
getPrimitiveName
-
getTypeFormatId
public int getTypeFormatId()Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Returns:
- the formatID of this class
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
- thrown on errorClassNotFoundException
- thrown on error- See Also:
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
- thrown on error
-
initialize
private void initialize(byte primitiveKind) -
initialize
-
initialize
-
initialize
private void initialize(byte category, DataTypeDescriptor sqlType, String javaClassName, byte primitiveKind) Initialize this JSQL type. Minion of all constructors.- Parameters:
category
- SQLTYPE, JAVA_CLASS, JAVA_PRIMITIVEsqlType
- corresponding SQL type if category=SQLTYPEjavaClassName
- corresponding java class if category=JAVA_CLASSprimitiveKind
- kind of primitive if category=JAVA_PRIMITIVE
-
getWrapperClassName
Gets the name of the java wrapper class corresponding to a primitive.- Parameters:
primitive
- BOOLEAN, INT, ... etc.- Returns:
- name of the java wrapper class corresponding to the primitive
-
getPrimitiveID
Translate the name of a java primitive to an id- Parameters:
name
- name of primitive- Returns:
- BOOLEAN, INT, ... etc if the name is that of a primitive. NOT_PRIMITIVE otherwise
-