|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ninja_squad.dbsetup.bind.Binders
public final class Binders
Utility class allowing to get various kinds of binders. The DefaultBinderConfiguration uses binders
returned by this class, based on the type of the parameter.
| Method Summary | |
|---|---|
static Binder |
dateBinder()
Returns a binder suitable for columns of type DATE. |
static Binder |
decimalBinder()
Returns a binder suitable for numeric, decimal columns. |
static Binder |
defaultBinder()
Returns the default binder. |
static Binder |
integerBinder()
Returns a binder suitable for numeric, integer columns. |
static Binder |
stringBinder()
Returns a binder suitable for columns of type CHAR and VARCHAR. |
static Binder |
timeBinder()
Returns a binder suitable for columns of type TIME. |
static Binder |
timestampBinder()
Returns a binder suitable for columns of type TIMESTAMP. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Binder defaultBinder()
stmt.setObject() to bind the parameter, except if the value being bound is of some
some well-known type not handled by JDBC:
enum: the name of the enum is boundjava.util.Date: the date is transformed to a java.sql.Timestampjava.util.Calendar: the date is transformed to a java.sql.Timestamp
public static Binder stringBinder()
Stringenum: the name of the enum is used as bound valueObject: the toString() of the object is used as bound value
public static Binder dateBinder()
java.sql.Datejava.util.Date: the milliseconds of the date are used to construct a java.sql.Datejava.util.Calendar: the milliseconds of the calendar are used to construct a java.sql.Date
String: the string is transformed to a java.sql.Date using the Date.valueOf()
methodstmt.setObject() is used to bind the value.
public static Binder timestampBinder()
java.sql.Timestampjava.util.Date: the milliseconds of the date are used to construct a java.sql.Timestampjava.util.Calendar: the milliseconds of the calendar are used to construct a
java.sql.TimestampString: the string is transformed to a java.sql.Timestamp using the
Timestamp.valueOf() method, or using the java.sql.Date.valueOf() method if the
string has less than 19 charactersstmt.setObject() is used to bind the value.
public static Binder timeBinder()
java.sql.Timejava.util.Date: the milliseconds of the date are used to construct a
java.sql.Timejava.util.Calendar: the milliseconds of the calendar are used to construct a
java.sql.Time
String: the string is transformed to a java.sql.Time using the
Time.valueOf() methodstmt.setObject() is used to bind the value.
public static Binder decimalBinder()
String: the string is transformed to a java.math.BigDecimal using its constructorstmt.setObject() is used to bind the value.
public static Binder integerBinder()
BigInteger: the object is transformed to a String and bound using
stmt.setObject(), with BIGINT as target type.
enum: the enum is transformed into an integer by taking its ordinalString: the string is bound using stmt.setObject(), with BIGINT as
target type.
stmt.setObject() is used to bind the value.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||