org.fluentjdbc.DatabaseUpdatable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-jdbc Show documentation
Show all versions of fluent-jdbc Show documentation
A Java library used to execute JDBC statements and build SQL
package org.fluentjdbc;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import java.util.Collection;
/**
* Interface to enforce consistent behavior of INSERT
and UPDATE
builders
*/
public interface DatabaseUpdatable> {
/**
* Adds the fieldName to the SQL statement and the value to the parameter list
*/
@CheckReturnValue
T setField(String field, @Nullable Object value);
/**
* Calls {@link #setField(String, Object)} for each fieldName and parameter
*/
@CheckReturnValue
T setFields(Collection fields, Collection> values);
/**
* Adds the fieldName to the SQL statement and the value to the parameter list, unless value is null
*/
@CheckReturnValue
default T setFieldIfPresent(String field, @Nullable Object value) {
if (value != null) {
//noinspection ResultOfMethodCallIgnored
setField(field, value);
}
//noinspection unchecked
return (T)this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy