io.ebeaninternal.server.persist.BindValues Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.server.persist;
import java.util.ArrayList;
/**
* Holds a list of bind values for binding to a PreparedStatement.
*/
public class BindValues {
final ArrayList list = new ArrayList<>();
/**
* Create with a Binder.
*/
public BindValues() {
}
/**
* Return the number of bind values.
*/
public int size() {
return list.size();
}
/**
* Add a bind value with its JDBC datatype.
*
* @param value the bind value
* @param dbType the type as per java.sql.Types
*/
public void add(Object value, int dbType, String name) {
list.add(new Value(value, dbType, name));
}
/**
* List of bind values.
*/
public ArrayList values() {
return list;
}
/**
* A Value has additionally the JDBC data type.
*/
public static class Value {
private final Object value;
private final int dbType;
private final String name;
/**
* Create the value.
*/
public Value(Object value, int dbType, String name) {
this.value = value;
this.dbType = dbType;
this.name = name;
}
/**
* Return the type as per java.sql.Types.
*/
public int getDbType() {
return dbType;
}
/**
* Return the value.
*/
public Object getValue() {
return value;
}
/**
* Return the property name.
*/
public String getName() {
return name;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy