Package org.apache.derby.catalog.types
Class UserDefinedTypeIdImpl
java.lang.Object
org.apache.derby.catalog.types.BaseTypeIdImpl
org.apache.derby.catalog.types.UserDefinedTypeIdImpl
- All Implemented Interfaces:
Externalizable
,Serializable
,Formatable
,TypedFormat
This type id describes a user defined type. There are 2 kinds of user defined types in Derby:
- Old-fashioned - In the original Cloudscape code, it was possible to declare a column's type to be the name of a Java class. Unlike ANSI UDTs, these user defined types were not schema objects themselves and they didn't have schema-qualified names. Some of the system tables have columns whose datatypes are old-fashioned user defined types. E.g., SYS.SYSALIASES.ALIASINFO.
- ANSI - As part of the work on DERBY-651, we added ANSI UDTs. These are user defined types which are declared via the CREATE TYPE statement. These have schema-qualified names. The CREATE TYPE statement basically binds a schema-qualified name to the name of a Java class.
- See Also:
-
Field Summary
FieldsFields inherited from class org.apache.derby.catalog.types.BaseTypeIdImpl
JDBCTypeId, schemaName, unqualifiedName
-
Constructor Summary
ConstructorsConstructorDescriptionPublic niladic constructor.UserDefinedTypeIdImpl
(String className) Constructor for a UserDefinedTypeIdImpl.UserDefinedTypeIdImpl
(String schemaName, String unqualifiedName, String className) Constructor for a UDT. -
Method Summary
Modifier and TypeMethodDescriptionReturn the java class name for this typeint
Get the formatID which corresponds to this class.boolean
isBound()
Has this user type been bound?void
Read this object from a stream of stored objects.boolean
userType()
Does this type id represent a user type?void
Write this object to a stream of stored objects.Methods inherited from class org.apache.derby.catalog.types.BaseTypeIdImpl
equals, getJDBCTypeId, getSchemaName, getSQLTypeName, getUnqualifiedName, hashCode, isAnsiUDT, toParsableString, toString
-
Field Details
-
className
This class implements Formatable. That means that it can write itself to and from a formatted stream. If you add more fields to this class, make sure that you also write/read them with the writeExternal()/readExternal() methods. If, inbetween releases, you add more fields to this class, then you should bump the version number emitted by the getTypeFormatId() method.
-
-
Constructor Details
-
UserDefinedTypeIdImpl
public UserDefinedTypeIdImpl()Public niladic constructor. Needed for Formatable interface to work. -
UserDefinedTypeIdImpl
Constructor for a UserDefinedTypeIdImpl. The SQLTypeName of a UserDefinedType is assumed to be its className for Derby-only UserDefinedTypes. For actual user created UDTs, the SQLTypeName is a schema qualified name.- Parameters:
className
- The SQL name of the type- Throws:
StandardException
-
UserDefinedTypeIdImpl
Constructor for a UDT.- Parameters:
schemaName
- Schema that the UDT lives in.unqualifiedName
- The name of the type inside that schema.className
- The Java class bound to the SQL type.
-
-
Method Details
-
getClassName
Return the java class name for this type -
userType
public boolean userType()Does this type id represent a user type?- Overrides:
userType
in classBaseTypeIdImpl
-
isBound
public boolean isBound()Has this user type been bound? -
readExternal
Read this object from a stream of stored objects.- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classBaseTypeIdImpl
- Parameters:
in
- read this.- Throws:
IOException
- thrown on errorClassNotFoundException
- thrown on error
-
writeExternal
Write this object to a stream of stored objects.- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classBaseTypeIdImpl
- Parameters:
out
- write bytes here.- Throws:
IOException
- thrown on error
-
getTypeFormatId
public int getTypeFormatId()Get the formatID which corresponds to this class.- Specified by:
getTypeFormatId
in interfaceTypedFormat
- Overrides:
getTypeFormatId
in classBaseTypeIdImpl
- Returns:
- the formatID of this class
-