org.fluentjdbc.DatabaseUpdateBuilder Maven / Gradle / Ivy
package org.fluentjdbc;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
/**
* Generate UPDATE
statements by collecting field names and parameters. Example:
*
*
* int count = table
* .where("id", id)
* .update()
* .setField("name", "Something")
* .setField("code", 102)
* .execute(connection);
*
*/
@ParametersAreNonnullByDefault
public class DatabaseUpdateBuilder implements DatabaseUpdatable {
private final DatabaseTable table;
private final List updateFields = new ArrayList<>();
private final List