org.eigenbase.reltype
Class RelRecordType

java.lang.Object
  extended by org.eigenbase.reltype.RelDataTypeImpl
      extended by org.eigenbase.reltype.RelRecordType
All Implemented Interfaces:
Serializable, RelDataType, RelDataTypeFamily

public class RelRecordType
extends RelDataTypeImpl
implements Serializable

RelRecordType represents a structured type having named fields.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/reltype/RelRecordType.java#16 $
Author:
jhyde
See Also:
Serialized Form

Nested Class Summary
private static class RelRecordType.SerializableRelRecordType
          Skinny object which has the same information content as a RelRecordType but skips redundant stuff like digest and the immutable list.
 
Field Summary
 
Fields inherited from class org.eigenbase.reltype.RelDataTypeImpl
digest, fieldList, fields
 
Constructor Summary
RelRecordType(RelDataTypeField[] fields)
          Creates a RecordType.
 
Method Summary
protected  void generateTypeString(StringBuilder sb, boolean withDetail)
          Generates a string representation of this type.
 int getPrecision()
          Gets the JDBC-defined precision for values of this type.
 SqlTypeName getSqlTypeName()
          Gets the SqlTypeName of this type.
 boolean isNullable()
          Queries whether this type allows null values.
private  Object writeReplace()
          Per Serializable API, provides a replacement object to be written during serialization.
 
Methods inherited from class org.eigenbase.reltype.RelDataTypeImpl
computeDigest, equals, getCharset, getCollation, getComparability, getComponentType, getFamily, getField, getFieldCount, getFieldList, getFieldOrdinal, getFields, getFullTypeString, getIntervalQualifier, getPrecedenceList, getScale, getSqlIdentifier, hashCode, isStruct, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RelRecordType

public RelRecordType(RelDataTypeField[] fields)
Creates a RecordType. This should only be called from a factory method.

Method Detail

getSqlTypeName

public SqlTypeName getSqlTypeName()
Description copied from interface: RelDataType
Gets the SqlTypeName of this type.

Specified by:
getSqlTypeName in interface RelDataType
Overrides:
getSqlTypeName in class RelDataTypeImpl
Returns:
SqlTypeName, or null if this is not an SQL predefined type

isNullable

public boolean isNullable()
Description copied from interface: RelDataType
Queries whether this type allows null values.

Specified by:
isNullable in interface RelDataType
Overrides:
isNullable in class RelDataTypeImpl
Returns:
whether type allows null values

getPrecision

public int getPrecision()
Description copied from interface: RelDataType
Gets the JDBC-defined precision for values of this type. Note that this is not always the same as the user-specified precision. For example, the type INTEGER has no user-specified precision, but this method returns 10 for an INTEGER type.

Specified by:
getPrecision in interface RelDataType
Overrides:
getPrecision in class RelDataTypeImpl
Returns:
number of decimal digits for exact numeric types; number of decimal digits in mantissa for approximate numeric types; number of decimal digits for fractional seconds of datetime types; length in characters for character types; length in bytes for binary types; length in bits for bit types; 1 for BOOLEAN

generateTypeString

protected void generateTypeString(StringBuilder sb,
                                  boolean withDetail)
Description copied from class: RelDataTypeImpl
Generates a string representation of this type.

Specified by:
generateTypeString in class RelDataTypeImpl
Parameters:
sb - StringBuffer into which to generate the string
withDetail - when true, all detail information needed to compute a unique digest (and return from getFullTypeString) should be included;

writeReplace

private Object writeReplace()
Per Serializable API, provides a replacement object to be written during serialization.

This implementation converts this RelRecordType into a SerializableRelRecordType, whose readResolve method converts it back to a RelRecordType during deserialization.