|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ninja_squad.dbsetup.operation.Insert.Builder
public static final class Insert.Builder
A builder used to create an Insert operation. Such a builder may only be used once. Once it has built its Insert
operation, all its methods throw an IllegalStateException
.
Insert.into(String)
Method Summary | |
---|---|
Insert |
build()
Builds the Insert operation. |
Insert.Builder |
columns(java.lang.String... columns)
Specifies the list of columns into which values wil be inserted. |
Insert.Builder |
useMetadata(boolean useMetadata)
Determines if the metadata must be used to get the appropriate binder for each inserted column (except the ones which have been associated explicitely with a Binder). |
Insert.Builder |
values(java.lang.Object... values)
Adds a row of values to insert. |
Insert.Builder |
withBinder(Binder binder,
java.lang.String... columns)
Associates a Binder to one or several columns. |
Insert.Builder |
withDefaultValue(java.lang.String column,
java.lang.Object value)
Specifies a default value to be inserted in a column for all the rows inserted by the Insert operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Insert.Builder columns(@Nonnull java.lang.String... columns)
values(Object...)
method.
columns
- the names of the columns to insert into.
java.lang.IllegalStateException
- if the Insert has already been built, or if this method has already been
called, or if one of the given columns is also specified as one of the "default value" columns.public Insert.Builder values(@Nonnull java.lang.Object... values)
values
- the values to insert.
java.lang.IllegalStateException
- if the Insert has already been built, or if the number of values doesn't match
the number of columns.public Insert.Builder withBinder(@Nonnull Binder binder, @Nonnull java.lang.String... columns)
binder
- the binder to use, regardless of the metadata, for the given columnscolumns
- the name of the columns to associate with the given Binder
java.lang.IllegalStateException
- if the Insert has already been built, or if any of the given columns is not
part of the columns or "default value" columns.public Insert.Builder withDefaultValue(@Nonnull java.lang.String column, java.lang.Object value)
column
- the name of the columnvalue
- the default value to insert into the column
java.lang.IllegalStateException
- if the Insert has already been built, or if the given column is part
of the columns to insert.public Insert.Builder useMetadata(boolean useMetadata)
true
. The insert
can be faster if set to false
, but in this case, the default
binder
will be used for all the columns (except the ones which have been associated explicitely with a
Binder).
java.lang.IllegalStateException
- if the Insert has already been built.public Insert build()
java.lang.IllegalStateException
- if the Insert has already been built, or if no column and no default value
column has been specified.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |