org.springframework.jdbc.core
Class ArgPreparedStatementSetter

java.lang.Object
  extended by org.springframework.jdbc.core.ArgPreparedStatementSetter
All Implemented Interfaces:
ParameterDisposer, PreparedStatementSetter

 class ArgPreparedStatementSetter
extends java.lang.Object
implements PreparedStatementSetter, ParameterDisposer

Simple adapter for PreparedStatementSetter that applies a given array of arguments.

Author:
Juergen Hoeller

Field Summary
private  java.lang.Object[] args
           
 
Constructor Summary
ArgPreparedStatementSetter(java.lang.Object[] args)
          Create a new ArgPreparedStatementSetter for the given arguments.
 
Method Summary
 void cleanupParameters()
          Close the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like a SqlLobValue).
protected  void doSetValue(java.sql.PreparedStatement ps, int parameterPosition, java.lang.Object argValue)
          Set the value for prepared statements specified parameter index using the passed in value.
 void setValues(java.sql.PreparedStatement ps)
          Set parameter values on the given PreparedStatement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

args

private final java.lang.Object[] args
Constructor Detail

ArgPreparedStatementSetter

public ArgPreparedStatementSetter(java.lang.Object[] args)
Create a new ArgPreparedStatementSetter for the given arguments.

Parameters:
args - the arguments to set
Method Detail

setValues

public void setValues(java.sql.PreparedStatement ps)
               throws java.sql.SQLException
Description copied from interface: PreparedStatementSetter
Set parameter values on the given PreparedStatement.

Specified by:
setValues in interface PreparedStatementSetter
Parameters:
ps - the PreparedStatement to invoke setter methods on
Throws:
java.sql.SQLException - if a SQLException is encountered (i.e. there is no need to catch SQLException)

doSetValue

protected void doSetValue(java.sql.PreparedStatement ps,
                          int parameterPosition,
                          java.lang.Object argValue)
                   throws java.sql.SQLException
Set the value for prepared statements specified parameter index using the passed in value. This method can be overridden by sub-classes if needed.

Parameters:
ps - the PreparedStatement
parameterPosition - index of the parameter position
argValue - the value to set
Throws:
java.sql.SQLException

cleanupParameters

public void cleanupParameters()
Description copied from interface: ParameterDisposer
Close the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like a SqlLobValue).

Specified by:
cleanupParameters in interface ParameterDisposer
See Also:
DisposableSqlTypeValue.cleanup(), SqlLobValue.cleanup()