db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dyre.Tjeldv...@Sun.COM
Subject Re: A question about types
Date Wed, 08 Mar 2006 14:28:15 GMT
Daniel John Debrunner <djd@apache.org> writes:

> TypeDescriptor represents a type in the catalogs, it's best to create an
> instance of the runtime type descriptor DataTypeDescriptor from it.
>
> TypeDescriptor td; // get from array/method
>
> // TypeId represents the fixed aspect of a type, without
> // nullability or any length attributes.
> TypeId typeId = TypeId.getBuiltInTypeId(td.getJDBCTypeId());
>
> DataTypeDescriptor dtd = new DataTypeDescriptor(typeId,
> td.getPrecision(), td.getScale(), td.isNullable(), td.getMaximumWidth());

Hmm, if I read the javadoc correctly it seems like both
DataTypeDescriptor and TypeDescriptorImpl (which both implement the
TypeDescriptor interface) already have a TypeId member variable, and
an accessor method called getTypeId(). Unfortunately, this method in
NOT part of the TypeDescriptor interface, so the only way to get at it is
to downcast the TypeDescriptor :(

Would it be bad to add getTypeId() to the TypeDescriptor interface?

-- 
dt


Mime
View raw message