Class RowDescriptorBuilder
- java.lang.Object
- 
- org.firebirdsql.gds.ng.fields.RowDescriptorBuilder
 
- 
 public final class RowDescriptorBuilder extends java.lang.ObjectBuilder to construct an immutableRowDescriptor.The row descriptor is constructed by defining the fields, and using addField()to add the current field definition to the row. The field data is then reset (as ifresetField()was called, to prepare for the next field to add.This class can also be used to construct individual FieldDescriptorobjects.- Since:
- 3.0
- Author:
- Mark Rotteveel
 
- 
- 
Constructor SummaryConstructors Constructor Description RowDescriptorBuilder(int size, DatatypeCoder datatypeCoder)Constructs an instance of RowDescriptorBuilder for size fields.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description RowDescriptorBuilderaddField()Adds the current field data to the row and prepares this builder for the next field by resetting all values.RowDescriptorBuilderaddField(FieldDescriptor fieldDescriptor)Adds theFieldDescriptoron the current fieldIndex as the next in the row, and increments the current field index by 1.RowDescriptorBuilderat(int index)Convenience shortcut forsetFieldIndex(int).RowDescriptorBuildercopyFieldFrom(FieldDescriptor sourceFieldDescriptor)Set this builder with the values of the sourceFieldDescriptorfor further modification through this builder.intgetCurrentFieldIndex()intgetFirstUnprocessedIndex()intgetSize()booleanisComplete()RowDescriptorBuilderresetField()Resets the fields of this builder to the Java defaults.RowDescriptorBuildersetFieldIndex(int index)Sets the field index for the current field under construction.RowDescriptorBuildersetFieldName(java.lang.String fieldName)Sets the (aliased) field name.RowDescriptorBuildersetLength(int length)Set the defined length of the field.RowDescriptorBuildersetOriginalName(java.lang.String originalName)Sets the original field name.RowDescriptorBuildersetOriginalTableName(java.lang.String originalTableName)Sets the original name of the underlying table.RowDescriptorBuildersetOwnerName(java.lang.String ownerName)Sets the owner (database username) of the field.RowDescriptorBuildersetScale(int scale)Set the scale of the field.RowDescriptorBuildersetSubType(int subType)Set the Firebird subtype of the field.RowDescriptorBuildersetTableAlias(java.lang.String tableAlias)Sets the alias of the underlying table.RowDescriptorBuildersetType(int type)Set the Firebird data type of the field.RowDescriptorBuildersimple(int type, int length, java.lang.String originalName, java.lang.String originalTableName)Convenience method to populate the basic field information used in metadata result sets (e.g.FieldDescriptortoFieldDescriptor()Creates aFieldDescriptorbased on the current field data of this RowDescriptorBuilder.RowDescriptortoRowDescriptor()Constructs theRowDescriptorwith the current content.
 
- 
- 
- 
Constructor Detail- 
RowDescriptorBuilderpublic RowDescriptorBuilder(int size, DatatypeCoder datatypeCoder)Constructs an instance of RowDescriptorBuilder for size fields.- Parameters:
- size- Number of fields
- datatypeCoder- DatatypeCoder for decoding field data
 
 
- 
 - 
Method Detail- 
getSizepublic int getSize() - Returns:
- Number of fields the row will hold.
 
 - 
setTypepublic RowDescriptorBuilder setType(int type) Set the Firebird data type of the field.- Parameters:
- type- Data type
- Returns:
- this builder
 
 - 
setSubTypepublic RowDescriptorBuilder setSubType(int subType) Set the Firebird subtype of the field.- Parameters:
- subType- Subtype
- Returns:
- this builder
- See Also:
- setType(int)
 
 - 
setScalepublic RowDescriptorBuilder setScale(int scale) Set the scale of the field.- Parameters:
- scale- Scale
- Returns:
- this builder
- See Also:
- setType(int)
 
 - 
setLengthpublic RowDescriptorBuilder setLength(int length) Set the defined length of the field.- Parameters:
- length- Defined (maximum) length of the field
- Returns:
- this builder
 
 - 
setFieldNamepublic RowDescriptorBuilder setFieldName(java.lang.String fieldName) Sets the (aliased) field name.- Parameters:
- fieldName- The field name
- Returns:
- this builder
- See Also:
- setOriginalName(String)
 
 - 
setTableAliaspublic RowDescriptorBuilder setTableAlias(java.lang.String tableAlias) Sets the alias of the underlying table.- Parameters:
- tableAlias- The table alias
- Returns:
- this builder
- See Also:
- setOriginalTableName(String)
 
 - 
setOriginalNamepublic RowDescriptorBuilder setOriginalName(java.lang.String originalName) Sets the original field name.- Parameters:
- originalName- The original field name
- Returns:
- this builder
- See Also:
- setFieldName(String)
 
 - 
setOriginalTableNamepublic RowDescriptorBuilder setOriginalTableName(java.lang.String originalTableName) Sets the original name of the underlying table.- Parameters:
- originalTableName- The table name
- Returns:
- this builder
- See Also:
- setTableAlias(String)
 
 - 
setFieldIndexpublic RowDescriptorBuilder setFieldIndex(int index) Sets the field index for the current field under construction.Even though addField()increments the current field index, it is advisable to always explicitly set the index using this method orat(int)as it improves readability.- Parameters:
- index- Index of the field
- Returns:
- this builder
- Throws:
- java.lang.IndexOutOfBoundsException- When- indexis not between 0 (inclusive) and- getSize()(exclusive)
- java.lang.IllegalStateException- When a- FieldDescriptoris already defined on the specified- index
 
 - 
atpublic RowDescriptorBuilder at(int index) Convenience shortcut forsetFieldIndex(int).- Parameters:
- index- Index of the field
- Returns:
- this builder
- See Also:
- setFieldIndex(int)
 
 - 
getCurrentFieldIndexpublic int getCurrentFieldIndex() - Returns:
- The index for the current field
 
 - 
setOwnerNamepublic RowDescriptorBuilder setOwnerName(java.lang.String ownerName) Sets the owner (database username) of the field.- Parameters:
- ownerName- Name of the owner
- Returns:
- this builder
 
 - 
simplepublic RowDescriptorBuilder simple(int type, int length, java.lang.String originalName, java.lang.String originalTableName) Convenience method to populate the basic field information used in metadata result sets (e.g. for use inFBDatabaseMetaData).- Parameters:
- type- Firebird data type
- length- Defined (maximum) length of the field
- originalName- The original field name
- originalTableName- The table name
- Returns:
- this builder
- See Also:
- setType(int),- setLength(int),- setOriginalTableName(String),- setOriginalName(String)
 
 - 
toFieldDescriptorpublic FieldDescriptor toFieldDescriptor() Creates aFieldDescriptorbased on the current field data of this RowDescriptorBuilder.- Returns:
- FieldDescriptor
 
 - 
resetFieldpublic RowDescriptorBuilder resetField() Resets the fields of this builder to the Java defaults.
 - 
copyFieldFrompublic RowDescriptorBuilder copyFieldFrom(FieldDescriptor sourceFieldDescriptor) Set this builder with the values of the sourceFieldDescriptorfor further modification through this builder.- Parameters:
- sourceFieldDescriptor- Source for the initial values
- Returns:
- this builder
 
 - 
addFieldpublic RowDescriptorBuilder addField() Adds the current field data to the row and prepares this builder for the next field by resetting all values.- Returns:
- this builder
- See Also:
- resetField()
 
 - 
addFieldpublic RowDescriptorBuilder addField(FieldDescriptor fieldDescriptor) Adds theFieldDescriptoron the current fieldIndex as the next in the row, and increments the current field index by 1.This method does not call resetField(), so a partial definition of a field can exist inside this builder after calling this method.- Parameters:
- fieldDescriptor- FieldDescriptor to add
- Returns:
- this builder
 
 - 
toRowDescriptorpublic RowDescriptor toRowDescriptor() Constructs theRowDescriptorwith the current content.This method can also return a partially filled RowDescriptor. Caller can check for completeness by callingisComplete().- Returns:
- RowDescriptor instance.
- See Also:
- isComplete()
 
 - 
isCompletepublic boolean isComplete() - Returns:
- true when all FieldDescriptorentries have been defined
 
 - 
getFirstUnprocessedIndexpublic int getFirstUnprocessedIndex() - Returns:
- Returns the index of the first unprocessed FieldDescriptor, or getSize()if all fields have been set.
 
 
- 
 
-