Package org.firebirdsql.jdbc.metadata
Class RowValueBuilder
- java.lang.Object
- 
- org.firebirdsql.jdbc.metadata.RowValueBuilder
 
- 
 public final class RowValueBuilder extends java.lang.ObjectBuilder forRowValueinstances.This class allows for sparse population of column values (ie: nullvalues can be skipped). It is intended for use in tests and classes likeFBDatabaseMetaData.The main advantage over RowValue.of(RowDescriptor, byte[][])is that it is clearer to which field the value is assigned, and it allows for sparse population (ie: skippingnullvalues).- Author:
- Mark Rotteveel
- See Also:
- RowValue.of(RowDescriptor, byte[][])
 
- 
- 
Constructor SummaryConstructors Constructor Description RowValueBuilder(RowDescriptor rowDescriptor)Creates instance of RowValueBuilder.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description RowValueBuilderat(int index)Convenience shortcut forsetFieldIndex(int).byte[]get(int index)Retrieves the field data set at the specified index.intgetSize()RowValueBuilderreset()Resets this builder to a new RowValue.RowValueBuilderset(byte[] fieldData)Sets the field data of the current field.RowValueBuildersetFieldIndex(int index)Sets the index of the current field to populate.RowValueBuildersetInt(int value)Sets the field data by encoding the providedint.RowValueBuildersetInt(java.lang.Number value)Sets the field data by encoding the providedNumberornull.RowValueBuildersetShort(int value)Sets the field data by encoding the providedintas ashort.RowValueBuildersetShort(short value)Sets the field data by encoding the providedshort.RowValueBuildersetShort(java.lang.Number value)Sets the field data by encoding the providedNumberas ashortornull.RowValueBuildersetString(java.lang.String value)Sets the field data by encoding the providedString.RowValuetoRowValue(boolean initialize)Returns the populatedRowValueand resets the RowValueBuilder.
 
- 
- 
- 
Constructor Detail- 
RowValueBuilderpublic RowValueBuilder(RowDescriptor rowDescriptor) Creates instance of RowValueBuilder.- Parameters:
- rowDescriptor- The RowDescriptor for the row(s) to be created
 
 
- 
 - 
Method Detail- 
setFieldIndexpublic RowValueBuilder setFieldIndex(int index) Sets the index of the current field to populate.- Parameters:
- index- Index of the field
- Returns:
- this builder
- Throws:
- java.lang.IndexOutOfBoundsException- When- indexis not between 0 (inclusive) and- getSize()(exclusive)
 
 - 
atpublic RowValueBuilder at(int index) Convenience shortcut forsetFieldIndex(int).- Parameters:
- index- Index
- Returns:
- this builder
- See Also:
- setFieldIndex(int)
 
 - 
setpublic RowValueBuilder set(byte[] fieldData) Sets the field data of the current field.- Parameters:
- fieldData- Data
- Returns:
- this builder
 
 - 
setIntpublic RowValueBuilder setInt(int value) Sets the field data by encoding the providedint.- Parameters:
- value- value
- Returns:
- this builder
- Since:
- 5
 
 - 
setIntpublic RowValueBuilder setInt(java.lang.Number value) Sets the field data by encoding the providedNumberornull.- Parameters:
- value- value
- Returns:
- this builder
- Since:
- 5
 
 - 
setShortpublic RowValueBuilder setShort(int value) Sets the field data by encoding the providedintas ashort.- Parameters:
- value- value
- Returns:
- this builder
- Since:
- 5
- See Also:
- setShort(short)
 
 - 
setShortpublic RowValueBuilder setShort(java.lang.Number value) Sets the field data by encoding the providedNumberas ashortornull.- Parameters:
- value- value
- Returns:
- this builder
- Since:
- 5
- See Also:
- setShort(short)
 
 - 
setShortpublic RowValueBuilder setShort(short value) Sets the field data by encoding the providedshort.- Parameters:
- value- value
- Returns:
- this builder
- Since:
- 5
- See Also:
- setShort(int)
 
 - 
setStringpublic RowValueBuilder setString(java.lang.String value) Sets the field data by encoding the providedString.- Parameters:
- value- value
- Returns:
- this builder
- Since:
- 5
 
 - 
getpublic byte[] get(int index) Retrieves the field data set at the specified index.- Parameters:
- index- Index
- Returns:
- The field data
- Throws:
- java.lang.IndexOutOfBoundsException- When @{code index} is not between 0 (inclusive) and- getSize()(exclusive)
 
 - 
resetpublic RowValueBuilder reset() Resets this builder to a new RowValue. All previous values set are cleared.- Returns:
- this builder.
 
 - 
getSizepublic int getSize() - Returns:
- Number of fields in the row
 
 - 
toRowValuepublic RowValue toRowValue(boolean initialize) Returns the populatedRowValueand resets the RowValueBuilder.- Parameters:
- initialize-- trueset field data to null for all uninitialized fields,- falseleaves fields uninitialized. In most cases you want to use- true.
- Returns:
- The row value object
- See Also:
- reset()
 
 
- 
 
-