package io.ebeaninternal.server.persist;
import java.util.ArrayList;
Holds a list of bind values for binding to a PreparedStatement.
/**
* Holds a list of bind values for binding to a PreparedStatement.
*/
class BindValues {
private final ArrayList<Value> list = new ArrayList<>();
Create with a Binder.
/**
* Create with a Binder.
*/
public BindValues() {
}
Add a bind value with its JDBC datatype.
Params: - value – the bind value
- dbType – the type as per java.sql.Types
/**
* 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.
/**
* List of bind values.
*/
public ArrayList<Value> values() {
return list;
}
A Value has additionally the JDBC data type.
/**
* 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.
/**
* Create the value.
*/
Value(Object value, int dbType, String name) {
this.value = value;
this.dbType = dbType;
this.name = name;
}
Return the type as per java.sql.Types.
/**
* Return the type as per java.sql.Types.
*/
public int getDbType() {
return dbType;
}
Return the value.
/**
* Return the value.
*/
public Object getValue() {
return value;
}
Return the property name.
/**
* Return the property name.
*/
public String getName() {
return name;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
}