com.onewebsql.util.jdbc
Class ListParameterHandler<T>

java.lang.Object
  extended by com.onewebsql.util.jdbc.ListParameterHandler<T>
All Implemented Interfaces:
ParameterHandler<List<T>>

public class ListParameterHandler<T>
extends Object
implements ParameterHandler<List<T>>

Implementation of a ParameterHandler interface which binds objects in the specified list to consecutive parameters of the specified PreparedStatement. The argument of the method ParameterHandler.bindParameters(PreparedStatement, Object) should be an array of objects of type T (T[]). Consecutive elements of the array are bound to consecutive parameters of PreparedStatement, like in the following code:

 statement.setObject(1, list.get(0));
 statement.setObject(2, list.get(1));
 ...
 


Constructor Summary
ListParameterHandler()
          Creates a new ListParameterHandler object.
 
Method Summary
 void bindParameters(PreparedStatement preparedStatement, List<T> parameters)
          Binds the specified parameters (using the methods set<Type>(int index, ...)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListParameterHandler

public ListParameterHandler()
Creates a new ListParameterHandler object.

Method Detail

bindParameters

public void bindParameters(PreparedStatement preparedStatement,
                           List<T> parameters)
                    throws SQLException
Description copied from interface: ParameterHandler
Binds the specified parameters (using the methods set<Type>(int index, ...)) to the specified PreparedStatement.

Specified by:
bindParameters in interface ParameterHandler<List<T>>
Parameters:
preparedStatement - SQL statement
parameters - parameters to be bound
Throws:
SQLException - if an error occurs while binding parameters


Copyright © 2011-2013 e-point SA. All Rights Reserved.