public static Object[] buildValueArray(ParsedSql parsedSql,Map<String,?> paramSource){
  List<Object> paramArray=new ArrayList<Object>();
  if (parsedSql.getNamedParameterCount() > 0 && parsedSql.getUnnamedParameterCount() > 0) {
    throw new IllegalStateException("You can't mix named and traditional ? placeholders. You have " + parsedSql.getNamedParameterCount() + " named parameter(s) and "+ parsedSql.getUnnamedParameterCount()+ " traditonal placeholder(s) in ["+ parsedSql.getOriginalSql()+ "]");
  }
  List<String> paramNames=parsedSql.getParameterNames();
  for (int i=0; i < paramNames.size(); i++) {
    String paramName=paramNames.get(i);
    Object value=paramSource.get(paramName);
    if (value instanceof Collection<?>) {
      Collection<?> collection=(Collection<?>)value;
      for (      Object object : collection) {
        paramArray.add(object);
      }
    }
 else {
      paramArray.add(value);
    }
  }
  return paramArray.toArray(new Object[paramArray.size()]);
}

public static Object [ ] buildValueArray ( ParsedSql parsedSql , Map < String , ? > paramSource ) { List < Object > paramArray = new ArrayList < Object > ( ) ; if ( parsedSql . getNamedParameterCount ( ) > 0 && parsedSql . getUnnamedParameterCount ( ) > 0 ) { throw new IllegalStateException ( "You can't mix named and traditional ? placeholders. You have " + parsedSql . getNamedParameterCount ( ) + " named parameter(s) and " + parsedSql . getUnnamedParameterCount ( ) + " traditonal placeholder(s) in [" + parsedSql . getOriginalSql ( ) + "]" ) ; } List < String > paramNames = parsedSql . getParameterNames ( ) ; for ( int i = 0 ; i < paramNames . size ( ) ; i ++ ) { String paramName = paramNames . get ( i ) ; Object value = paramSource . get ( paramName ) ; if ( value instanceof Collection < ? > ) { Collection < ? > collection = ( Collection < ? > ) value ; for ( Object object : collection ) { paramArray . add ( object ) ; } } else { paramArray . add ( value ) ; } } return paramArray . toArray ( new Object [ paramArray . size ( ) ] ) ; }
convert a map of named parameter values to a corresponding array .
