public class MojoRowBuilder
extends java.lang.Object
The builder is used to build rows for a MojoFrameBuilder. Rows are constructed by adding values in String form to a builder instance. The rows can then be added to a MojoFrameBuilder by calling MojoFrameBuilder.addRow(MojoRowBuilder). MojoRowBuilders can be initialized in a “strict” mode, where an exception is thrown whenever there is an attempt to set a value to a column name that is not defined in the builder. Additionally, “strict” MojoRowBuilders will throw an exception if there is an attempt to create a row without every column being set a value beforehand.
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the state of the row builder
|
boolean |
containsName(java.lang.String name)
Determine if there is a column associated with name
name. |
boolean |
isSet(int idx)
Determine whether the column at index
idx has had a value set. |
boolean |
isSet(java.lang.String name)
Determine whether the column associated with name
name has had a value set. |
boolean |
isStrict()
Determine if this row builder is in “strict” mode.
|
MojoRowBuilder |
setBool(int idx,
java.lang.Boolean value) |
MojoRowBuilder |
setBool(java.lang.String name,
java.lang.Boolean value) |
MojoRowBuilder |
setByte(int idx,
java.lang.Byte value) |
MojoRowBuilder |
setByte(java.lang.String name,
java.lang.Byte value) |
MojoRowBuilder |
setChar(int idx,
java.lang.Character value) |
MojoRowBuilder |
setChar(java.lang.String name,
java.lang.Character value) |
MojoRowBuilder |
setDate(int idx,
java.sql.Date value) |
MojoRowBuilder |
setDate(java.lang.String name,
java.sql.Date value) |
MojoRowBuilder |
setDouble(int idx,
java.lang.Double value) |
MojoRowBuilder |
setDouble(java.lang.String name,
java.lang.Double value) |
MojoRowBuilder |
setFloat(int idx,
java.lang.Float value) |
MojoRowBuilder |
setFloat(java.lang.String name,
java.lang.Float value) |
MojoRowBuilder |
setInt(int idx,
java.lang.Integer value) |
MojoRowBuilder |
setInt(java.lang.String name,
java.lang.Integer value) |
MojoRowBuilder |
setLong(int idx,
java.lang.Long value) |
MojoRowBuilder |
setLong(java.lang.String name,
java.lang.Long value) |
MojoRowBuilder |
setShort(int idx,
java.lang.Short value) |
MojoRowBuilder |
setShort(java.lang.String name,
java.lang.Short value) |
MojoRowBuilder |
setString(int idx,
java.lang.String value) |
MojoRowBuilder |
setString(java.lang.String name,
java.lang.String value) |
MojoRowBuilder |
setTimestamp(int idx,
java.sql.Timestamp value) |
MojoRowBuilder |
setTimestamp(java.lang.String name,
java.sql.Timestamp value) |
MojoRowBuilder |
setValue(int idx,
java.lang.String value)
Set a value to an index in the row
|
MojoRowBuilder |
setValue(java.lang.String name,
java.lang.String value)
Set a value to the position associated with column
name in the row. |
MojoRowBuilder |
setValues(java.lang.Object[] values)
Set the entire row to
values. |
int |
size()
Get the number values a row resulting from this builder would have
|
public MojoRowBuilder setValue(java.lang.String name, java.lang.String value)
Set a value to the position associated with column name in the row. If this row builder instance is in “strict” mode, an IllegalArgumentException is thrown if name is not found in this builder. Otherwise nothing happens.
The value is specified as a string and the call will try to convert the value to actual column type.
name - The name of the column to where the value should be setvalue - The value to be setpublic MojoRowBuilder setValue(int idx, java.lang.String value)
Set a value to an index in the row
idx - The index where the value should be setvalue - The value to be setpublic MojoRowBuilder setBool(java.lang.String name, java.lang.Boolean value)
public MojoRowBuilder setChar(java.lang.String name, java.lang.Character value)
public MojoRowBuilder setByte(java.lang.String name, java.lang.Byte value)
public MojoRowBuilder setShort(java.lang.String name, java.lang.Short value)
public MojoRowBuilder setInt(java.lang.String name, java.lang.Integer value)
public MojoRowBuilder setLong(java.lang.String name, java.lang.Long value)
public MojoRowBuilder setFloat(java.lang.String name, java.lang.Float value)
public MojoRowBuilder setDouble(java.lang.String name, java.lang.Double value)
public MojoRowBuilder setString(java.lang.String name, java.lang.String value)
public MojoRowBuilder setDate(java.lang.String name, java.sql.Date value)
public MojoRowBuilder setTimestamp(java.lang.String name, java.sql.Timestamp value)
public MojoRowBuilder setBool(int idx, java.lang.Boolean value)
public MojoRowBuilder setByte(int idx, java.lang.Byte value)
public MojoRowBuilder setShort(int idx, java.lang.Short value)
public MojoRowBuilder setChar(int idx, java.lang.Character value)
public MojoRowBuilder setInt(int idx, java.lang.Integer value)
public MojoRowBuilder setLong(int idx, java.lang.Long value)
public MojoRowBuilder setFloat(int idx, java.lang.Float value)
public MojoRowBuilder setDouble(int idx, java.lang.Double value)
public MojoRowBuilder setString(int idx, java.lang.String value)
public MojoRowBuilder setDate(int idx, java.sql.Date value)
public MojoRowBuilder setTimestamp(int idx, java.sql.Timestamp value)
public MojoRowBuilder setValues(java.lang.Object[] values)
Set the entire row to values.
The parameter values needs to contain actual object matching types of columns.
values - The array of values to be set into the row.public void clear()
Clear the state of the row builder
public int size()
Get the number values a row resulting from this builder would have
public boolean isStrict()
Determine if this row builder is in “strict” mode. A “strict” row builder will throw an exception if a value is attempted to be set to a column whose name is not associated with an index. Additionally, toMojoRow() will throw an exception unless all values have been set.
true if this row builder instance is in “strict” mode; false otherwise.public boolean isSet(java.lang.String name)
Determine whether the column associated with name name has had a value set.
name - The name of the columntrue if the column associated with name name has had a value set; false otherwise.public boolean isSet(int idx)
Determine whether the column at index idx has had a value set.
idx - The index of the columntrue if the column at index idx has had a value set; false otherwise.public boolean containsName(java.lang.String name)
Determine if there is a column associated with name name.
name - true if there exists a column associated with name name; false otherwise.