com.ninja_squad.dbsetup.operation
Class Insert.RowBuilder

java.lang.Object
  extended by com.ninja_squad.dbsetup.operation.Insert.RowBuilder
Enclosing class:
Insert

public static final class Insert.RowBuilder
extends java.lang.Object

A row builder, constructed with Insert.Builder.row(). This builder allows adding a row with named columns to an Insert:

   Insert insert =
       Insert.into("CLIENT")
             .columns("CLIENT_ID", "FIRST_NAME", "LAST_NAME", "DATE_OF_BIRTH", "CLIENT_TYPE")
             .row().column("CLIENT_ID", 1L)
                   .column("FIRST_NAME", "John")
                   .column("LAST_NAME", "Doe")
                   .column("DATE_OF_BIRTH", "1975-07-19")
                   .column("CLIENT_TYPE", ClientType.NORMAL)
                   .end()
             .row().column("CLIENT_ID", 2L)
                   .column("FIRST_NAME", "Jack")
                   .column("LAST_NAME", "Smith")
                   .column("DATE_OF_BIRTH", "1969-08-22")
                   .column("CLIENT_TYPE", ClientType.HIGH_PRIORITY)
                   .end()
             .build();
 
You may omit the call to columns(). In that case, the columns of the Insert will be the columns specified in the first added row.


Method Summary
 Insert.RowBuilder column(java.lang.String name, java.lang.Object value)
          Adds a new named column to the row.
 Insert.Builder end()
          Ends the row, adds it to the Insert Builder and returns it, for chaining.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

column

public Insert.RowBuilder column(@Nonnull
                                java.lang.String name,
                                java.lang.Object value)
Adds a new named column to the row. If a previous value has already been added for the same column, it's replaced by this new value.

Parameters:
name - the name of the column, which must match with a column name defined in the Insert Builder
value - the value of the column for the constructed row
Returns:
this builder, for chaining
Throws:
java.lang.IllegalArgumentException - if the given name is not the name of one of the columns to insert

end

public Insert.Builder end()
Ends the row, adds it to the Insert Builder and returns it, for chaining.

Returns:
the Insert Builder