com.ninja_squad.dbsetup.bind
Class DefaultBinderConfiguration
java.lang.Object
com.ninja_squad.dbsetup.bind.DefaultBinderConfiguration
- All Implemented Interfaces:
- BinderConfiguration
public class DefaultBinderConfiguration
- extends java.lang.Object
- implements BinderConfiguration
Default implementation of BinderConfiguration
, used by default by DbSetup
.
Method Summary |
Binder |
getBinder(java.sql.ParameterMetaData metadata,
int param)
Uses the parameter type of the given parameter and returns the following Binders depending on the type
got from the metadata. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
INSTANCE
public static final DefaultBinderConfiguration INSTANCE
- A shareable, reusable instance of this class.
DefaultBinderConfiguration
protected DefaultBinderConfiguration()
- Constructor. Protected because it doesn't make much sense to instantiate this class,
but extending it can be useful.
getBinder
public Binder getBinder(java.sql.ParameterMetaData metadata,
int param)
throws java.sql.SQLException
- Uses the parameter type of the given parameter and returns the following Binders depending on the type
got from the metadata.
- null metadata (i.e. metadata not used or not returned):
Binders.defaultBinder()
- VARCHAR, CHAR, LONGNVARCHAR, LONGVARCHAR, NCHAR, NVARCHAR :
Binders.stringBinder()
- DATE :
Binders.dateBinder()
- TIME :
Binders.timeBinder()
- TIMESTAMP :
Binders.timestampBinder()
- INTEGER, BIGINT, SMALLINT, TINYINT :
Binders.integerBinder()
- DECIMAL, DOUBLE, FLOAT, NUMERIC, REAL :
Binders.decimalBinder()
- other :
Binders.defaultBinder()
If the parameter type can't be obtained from the metadata, the default binder is returned.
- Specified by:
getBinder
in interface BinderConfiguration
- Parameters:
metadata
- the metadata allowing to decide which Binder to return. null
if the Insert has been
configured to not use metadata, or if the JDBC driver returned null metadata, or the JDBC driver threw a
SQLException when asked for the metadataparam
- the param for which a binder is requested
- Returns:
- the binder for the given param and its metadata
- Throws:
java.sql.SQLException
- if a SQLException occurs while using the metadata
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object