Package org.springframework.jdbc.core

# Class ArgumentPreparedStatementSetter

java.lang.Object
org.springframework.jdbc.core.ArgumentPreparedStatementSetter

All Implemented Interfaces:
  `ParameterDisposer`, `PreparedStatementSetter`

public class ArgumentPreparedStatementSetter extends Object implements PreparedStatementSetter, ParameterDisposer
Simple adapter for `PreparedStatementSetter` that applies a given array of arguments.

Since:
  3.2.3
Author:
  Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`ArgumentPreparedStatementSetter(Object[] args)`
Create a new `ArgumentPreparedStatementSetter` for the given arguments.

## Method Summary

Modifier and Type
Method
Description
`void`
`cleanupParameters()`
Close the resources allocated by parameters that the implementing object holds, for example in case of a DisposableSqlTypeValue (like an SqlLobValue).
`protected void`
`doSetValue(PreparedStatement ps, int parameterPosition, Object argValue)`
Set the value for the prepared statement's specified parameter position using the supplied value.
`void`
`setValues(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`

## Constructor Details

### ArgumentPreparedStatementSetter

public ArgumentPreparedStatementSetter(@Nullable Object[] args)
Create a new `ArgumentPreparedStatementSetter` for the given arguments.

Parameters:
  `args` - the arguments to set

## Method Details

### setValues

public void setValues(PreparedStatement ps) throws 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:
  `SQLException` - if an SQLException is encountered (i.e. there is no need to catch SQLException)

### doSetValue

protected void doSetValue(PreparedStatement ps, int parameterPosition, @Nullable Object argValue) throws SQLException
Set the value for the prepared statement's specified parameter position using the supplied value.

This method can be overridden by subclasses if needed.

Parameters:
  `ps` - the PreparedStatement
  `parameterPosition` - index of the parameter position
  `argValue` - the value to set
Throws:
  `SQLException` - if thrown by PreparedStatement methods

### 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 an SqlLobValue).

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