public 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
.
Its main advantage over RowValue.of(RowDescriptor, byte[][])
is that it is clearer to which field
the value is assigned, and it 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 |
resetField()
Resets to current field to its default uninitialized state.
|
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.
|
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 byte[] get(int index)
index
- Indexjava.lang.IndexOutOfBoundsException
- When index
is not between 0 (inclusive) and getSize()
(exclusive)public RowValueBuilder resetField()
public RowValueBuilder reset()
Not to be confused with resetField()
.
public int getSize()
public RowValue toRowValue(boolean initialize)
RowValue
and resets the RowValueBuilder.initialize
- true
set field data to null for all uninitialized
FieldValue
, false
leaves to fields uninitialized. In
most cases you want to use true
.reset()
Copyright © 2001-2021 Jaybird (Firebird JDBC/JCA) team. All rights reserved.