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

java.lang.Object
  extended by com.onewebsql.util.jdbc.ArrayParameterHandler<T>
Type Parameters:
T - type of objects in the array
All Implemented Interfaces:
ParameterHandler<T[]>

public class ArrayParameterHandler<T>
extends Object
implements ParameterHandler<T[]>

Implementation of a ParameterHandler interface which binds objects in the specified array 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, parameters[0]);
 statement.setObject(2, parameters[1]);
 ...
 


Constructor Summary
ArrayParameterHandler()
          Creates a new ArrayParameterHandler object.
 
Method Summary
 void bindParameters(PreparedStatement preparedStatement, 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

ArrayParameterHandler

public ArrayParameterHandler()
Creates a new ArrayParameterHandler object.

Method Detail

bindParameters

public void bindParameters(PreparedStatement preparedStatement,
                           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<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.