Package org.firebirdsql.gds.ng.fields
Class FieldDescriptor
- java.lang.Object
- 
- org.firebirdsql.gds.ng.fields.FieldDescriptor
 
- 
 public final class FieldDescriptor extends java.lang.ObjectThe classFieldDescriptorcontains the column metadata of the XSQLVAR server data structure used to describe one column for input or output.FieldDescriptor is an immutable type, the value of a field is maintained separately in RowValue.- Version:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Constructor SummaryConstructors Constructor Description FieldDescriptor(int position, DatatypeCoder datatypeCoder, int type, int subType, int scale, int length, java.lang.String fieldName, java.lang.String tableAlias, java.lang.String originalName, java.lang.String originalTableName, java.lang.String ownerName)Constructor for metadata FieldDescriptor.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)intgetCharacterLength()The length in characters of this field.DatatypeCodergetDatatypeCoder()IEncodingFactorygetEncodingFactory()java.lang.StringgetFieldName()intgetLength()java.lang.StringgetOriginalName()java.lang.StringgetOriginalTableName()java.lang.StringgetOwnerName()intgetPosition()intgetScale()intgetSubType()java.lang.StringgetTableAlias()intgetType()inthashCode()booleanisDbKey()Determines if this is a db-key (RDB$DB_KEY) of a table.booleanisFbType(int fbType)Check if the type of this field is the specified Firebird data type.booleanisNullable()booleanisVarying()java.lang.StringtoString()booleantypeEquals(FieldDescriptor other)Limited equals that only checks if the data type in the provided field descriptor is the same as this descriptor.
 
- 
- 
- 
Constructor Detail- 
FieldDescriptorpublic FieldDescriptor(int position, DatatypeCoder datatypeCoder, int type, int subType, int scale, int length, java.lang.String fieldName, java.lang.String tableAlias, java.lang.String originalName, java.lang.String originalTableName, java.lang.String ownerName)Constructor for metadata FieldDescriptor.- Parameters:
- position- Position of this field (0-based), or- -1if position is not known (eg for test code)
- datatypeCoder- Instance of DatatypeCoder to use when decoding column data (note that another instance may be derived internally, which then will be returned by- getDatatypeCoder())
- type- Column SQL type
- subType- Column subtype
- scale- Column scale
- length- Column defined length
- fieldName- Column alias name
- tableAlias- Column table alias
- originalName- Column original name
- originalTableName- Column original table
- ownerName- Owner of the column/table
 
 
- 
 - 
Method Detail- 
getPositionpublic int getPosition() - Returns:
- The 0-based position of this field (or -1)
 
 - 
getDatatypeCoderpublic DatatypeCoder getDatatypeCoder() - Returns:
- The DatatypeCoderto use when decoding field data.
 
 - 
getEncodingFactorypublic IEncodingFactory getEncodingFactory() - Returns:
- The IEncodingFactoryfor the associated connection.
 
 - 
getTypepublic int getType() - Returns:
- The Firebird type of this field
 
 - 
getSubTypepublic int getSubType() - Returns:
- The Firebird subtype of this field
 
 - 
getScalepublic int getScale() - Returns:
- The scale of this field
 
 - 
getLengthpublic int getLength() - Returns:
- The declared (maximum) length of this field
 
 - 
getFieldNamepublic java.lang.String getFieldName() - Returns:
- The (aliased) field name
 
 - 
getTableAliaspublic java.lang.String getTableAlias() - Returns:
- The (aliased) table name
 
 - 
getOriginalNamepublic java.lang.String getOriginalName() - Returns:
- The original name of the field (eg the column name in the table)
 
 - 
getOriginalTableNamepublic java.lang.String getOriginalTableName() - Returns:
- The original table name
 
 - 
getOwnerNamepublic java.lang.String getOwnerName() - Returns:
- The owner
 
 - 
isVaryingpublic boolean isVarying() - Returns:
- trueif the type is variable length (ie- ISCConstants.SQL_VARYING).
 
 - 
isFbTypepublic boolean isFbType(int fbType) Check if the type of this field is the specified Firebird data type.This method assumes the not-nullable data type is passed, on checking the nullable bit of getType()is set to0.- Parameters:
- fbType- One of the- SQL_data type identifier values
- Returns:
- trueif the type is the same as the type of this field
 
 - 
isNullablepublic boolean isNullable() - Returns:
- trueif this field is nullable.
 
 - 
isDbKeypublic boolean isDbKey() Determines if this is a db-key (RDB$DB_KEY) of a table.NOTE: Technically it could also be a normal CHAR CHARACTER SET OCTETScolumn calledDB_KEY.- Returns:
- trueif the field is a RDB$DB_KEY
- Since:
- 4.0
 
 - 
getCharacterLengthpublic int getCharacterLength() The length in characters of this field.This takes into account the max bytes per character of the character set. - Returns:
- Character length, or -1for non-character types (including blobs)
 
 - 
typeEqualspublic boolean typeEquals(FieldDescriptor other) Limited equals that only checks if the data type in the provided field descriptor is the same as this descriptor.The fields checked are: - type
- subType
- scale
- length
 - Parameters:
- other- Field descriptor to check
- Returns:
- truewhen- otheris not null and has the same type definition as this instance,- falseotherwise.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-