Polishing (includes varargs for selected String array setters)

This commit is contained in:
Juergen Hoeller
2014-08-09 00:19:56 +02:00
parent d61353db51
commit c08ded769a
34 changed files with 376 additions and 390 deletions

View File

@@ -130,7 +130,7 @@ public class PreparedStatementCreatorFactory {
/**
* Set the column names of the auto-generated keys.
*/
public void setGeneratedKeysColumnNames(String[] names) {
public void setGeneratedKeysColumnNames(String... names) {
this.generatedKeysColumnNames = names;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
@@ -292,7 +291,7 @@ public class TableMetaDataContext {
* Build the insert string based on configuration and metadata information
* @return the insert string to be used
*/
public String createInsertString(String[] generatedKeyNames) {
public String createInsertString(String... generatedKeyNames) {
HashSet<String> keys = new HashSet<String>(generatedKeyNames.length);
for (String key : generatedKeyNames) {
keys.add(key.toUpperCase());

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -179,21 +179,6 @@ public abstract class AbstractJdbcInsert {
return Collections.unmodifiableList(this.declaredColumns);
}
/**
* Get the names of any generated keys
*/
public String[] getGeneratedKeyNames() {
return this.generatedKeyNames;
}
/**
* Set the names of any generated keys
*/
public void setGeneratedKeyNames(String[] generatedKeyNames) {
checkIfConfigurationModificationIsAllowed();
this.generatedKeyNames = generatedKeyNames;
}
/**
* Specify the name of a single generated key column
*/
@@ -202,6 +187,21 @@ public abstract class AbstractJdbcInsert {
this.generatedKeyNames = new String[] {generatedKeyName};
}
/**
* Set the names of any generated keys
*/
public void setGeneratedKeyNames(String... generatedKeyNames) {
checkIfConfigurationModificationIsAllowed();
this.generatedKeyNames = generatedKeyNames;
}
/**
* Get the names of any generated keys
*/
public String[] getGeneratedKeyNames() {
return this.generatedKeyNames;
}
/**
* Specify whether the parameter metadata for the call should be used. The default is true.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -210,7 +210,7 @@ public abstract class RdbmsOperation implements InitializingBean {
* Set the column names of the auto-generated keys.
* @see java.sql.Connection#prepareStatement(String, String[])
*/
public void setGeneratedKeysColumnNames(String[] names) {
public void setGeneratedKeysColumnNames(String... names) {
if (isCompiled()) {
throw new InvalidDataAccessApiUsageException(
"The column names for the generated keys must be set before the operation is compiled");