public final class RowValueBuilder
extends java.lang.Object
RowValue instances.
This class allows for sparse population of column values (ie: null values can be skipped). It is
intended for use in tests and classes like FBDatabaseMetaData.
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: skipping null values).
RowValue.of(RowDescriptor, byte[][])| Constructor and Description |
|---|
RowValueBuilder(RowDescriptor rowDescriptor)
Creates instance of RowValueBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
RowValueBuilder |
at(int index)
Convenience shortcut for
setFieldIndex(int). |
byte[] |
get(int index)
Retrieves the field data set at the specified index.
|
int |
getSize() |
RowValueBuilder |
reset()
Resets this builder to a new RowValue.
|
RowValueBuilder |
set(byte[] fieldData)
Sets the field data of the current field.
|
RowValueBuilder |
setFieldIndex(int index)
Sets the index of the current field to populate.
|
RowValueBuilder |
setInt(int value)
Sets the field data by encoding the provided
int. |
RowValueBuilder |
setInt(java.lang.Number value)
Sets the field data by encoding the provided
Number or null. |
RowValueBuilder |
setShort(int value)
Sets the field data by encoding the provided
int as a short. |
RowValueBuilder |
setShort(java.lang.Number value)
Sets the field data by encoding the provided
Number as a short or null. |
RowValueBuilder |
setShort(short value)
Sets the field data by encoding the provided
short. |
RowValueBuilder |
setString(java.lang.String value)
Sets the field data by encoding the provided
String. |
RowValue |
toRowValue(boolean initialize)
Returns the populated
RowValue and resets the RowValueBuilder. |
public RowValueBuilder(RowDescriptor rowDescriptor)
rowDescriptor - The RowDescriptor for the row(s) to be createdpublic RowValueBuilder setFieldIndex(int index)
index - Index of the fieldjava.lang.IndexOutOfBoundsException - When index is not between 0 (inclusive) and getSize() (exclusive)public RowValueBuilder at(int index)
setFieldIndex(int).index - IndexsetFieldIndex(int)public RowValueBuilder set(byte[] fieldData)
fieldData - Datapublic RowValueBuilder setInt(int value)
int.value - valuepublic RowValueBuilder setInt(java.lang.Number value)
Number or null.value - valuepublic RowValueBuilder setShort(int value)
int as a short.value - valuesetShort(short)public RowValueBuilder setShort(java.lang.Number value)
Number as a short or null.value - valuesetShort(short)public RowValueBuilder setShort(short value)
short.value - valuesetShort(int)public RowValueBuilder setString(java.lang.String value)
String.value - valuepublic byte[] get(int index)
index - Indexjava.lang.IndexOutOfBoundsException - When @{code index} is not between 0 (inclusive) and getSize() (exclusive)public RowValueBuilder reset()
public int getSize()
public RowValue toRowValue(boolean initialize)
RowValue and resets the RowValueBuilder.initialize - true set field data to null for all uninitialized fields, false leaves fields
uninitialized. In most cases you want to use true.reset()Copyright © 2001-2024 Jaybird (Firebird JDBC) team. All rights reserved.