11/* 
2-  * Copyright 2002-2007  the original author or authors. 
2+  * Copyright 2002-2013  the original author or authors. 
33 * 
44 * Licensed under the Apache License, Version 2.0 (the "License"); 
55 * you may not use this file except in compliance with the License. 
2020import  java .sql .SQLException ;
2121import  java .sql .Types ;
2222import  java .util .Collection ;
23- import  java .util .Iterator ;
2423
2524import  org .springframework .dao .InvalidDataAccessApiUsageException ;
2625
2726/** 
28-  * Simple adapter for PreparedStatementSetter that applies 
27+  * Simple adapter for {@link  PreparedStatementSetter}  that applies 
2928 * given arrays of arguments and JDBC argument types. 
3029 * 
3130 * @author Juergen Hoeller 
31+  * @since 3.2.3 
3232 */ 
33- class  ArgTypePreparedStatementSetter  implements  PreparedStatementSetter , ParameterDisposer  {
33+ public   class  ArgumentTypePreparedStatementSetter  implements  PreparedStatementSetter , ParameterDisposer  {
3434
3535	private  final  Object [] args ;
3636
@@ -42,7 +42,7 @@ class ArgTypePreparedStatementSetter implements PreparedStatementSetter, Paramet
4242	 * @param args the arguments to set 
4343	 * @param argTypes the corresponding SQL types of the arguments 
4444	 */ 
45- 	public  ArgTypePreparedStatementSetter (Object [] args , int [] argTypes ) {
45+ 	public  ArgumentTypePreparedStatementSetter (Object [] args , int [] argTypes ) {
4646		if  ((args  != null  && argTypes  == null ) || (args  == null  && argTypes  != null ) ||
4747				(args  != null  && args .length  != argTypes .length )) {
4848			throw  new  InvalidDataAccessApiUsageException ("args and argTypes parameters must match" );
@@ -59,12 +59,10 @@ public void setValues(PreparedStatement ps) throws SQLException {
5959				Object  arg  = this .args [i ];
6060				if  (arg  instanceof  Collection  && this .argTypes [i ] != Types .ARRAY ) {
6161					Collection  entries  = (Collection ) arg ;
62- 					for  (Iterator  it  = entries .iterator (); it .hasNext ();) {
63- 						Object  entry  = it .next ();
62+ 					for  (Object  entry  : entries ) {
6463						if  (entry  instanceof  Object []) {
65- 							Object [] valueArray  = ((Object [])entry );
66- 							for  (int  k  = 0 ; k  < valueArray .length ; k ++) {
67- 								Object  argValue  = valueArray [k ];
64+ 							Object [] valueArray  = ((Object []) entry );
65+ 							for  (Object  argValue  : valueArray ) {
6866								doSetValue (ps , parameterPosition , this .argTypes [i ], argValue );
6967								parameterPosition ++;
7068							}
@@ -94,6 +92,7 @@ public void setValues(PreparedStatement ps) throws SQLException {
9492	 */ 
9593	protected  void  doSetValue (PreparedStatement  ps , int  parameterPosition , int  argType , Object  argValue )
9694			throws  SQLException  {
95+ 
9796		StatementCreatorUtils .setParameterValue (ps , parameterPosition , argType , argValue );
9897	}
9998
0 commit comments