Browse Source

Use varargs for array elements

See gh-1850
pull/30891/head
Juergen Hoeller 3 years ago
parent
commit
094eb3e236
  1. 5
      spring-jdbc/src/main/java/org/springframework/jdbc/support/SqlArrayValue.java

5
spring-jdbc/src/main/java/org/springframework/jdbc/support/SqlArrayValue.java

@ -28,7 +28,8 @@ import org.springframework.util.Assert;
* Common {@link SqlValue} implementation for JDBC {@link Array} creation * Common {@link SqlValue} implementation for JDBC {@link Array} creation
* based on the JDBC 4 {@link java.sql.Connection#createArrayOf} method. * based on the JDBC 4 {@link java.sql.Connection#createArrayOf} method.
* *
* <p>Also serves as a template for custom {@link SqlValue} implementations. * <p>Also serves as a template for custom {@link SqlValue} implementations
* with cleanup demand.
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Philippe Marschall * @author Philippe Marschall
@ -50,7 +51,7 @@ public class SqlArrayValue implements SqlValue {
* @param elements the elements to populate the {@code Array} object with * @param elements the elements to populate the {@code Array} object with
* @see java.sql.Connection#createArrayOf * @see java.sql.Connection#createArrayOf
*/ */
public SqlArrayValue(String typeName, Object[] elements) { public SqlArrayValue(String typeName, Object... elements) {
Assert.notNull(typeName, "Type name must not be null"); Assert.notNull(typeName, "Type name must not be null");
Assert.notNull(elements, "Elements array must not be null"); Assert.notNull(elements, "Elements array must not be null");
this.typeName = typeName; this.typeName = typeName;

Loading…
Cancel
Save