From a1f62df2924e0f46d2508266fea83f4edc2c60a8 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 26 Jun 2013 09:41:17 +0300 Subject: [PATCH] Use varargs instead of array where appropriate (#4513) Change-Id: Ide9349b6afa7e56ae04b7727134971ebf81c0b03 --- server/src/com/vaadin/data/Buffered.java | 15 +-------------- server/src/com/vaadin/data/Validator.java | 2 +- server/src/com/vaadin/data/util/BeanItem.java | 2 +- .../com/vaadin/data/util/sqlcontainer/RowId.java | 2 +- .../data/util/sqlcontainer/TemporaryRowId.java | 2 +- server/src/com/vaadin/event/ShortcutAction.java | 6 +++--- .../com/vaadin/server/CompositeErrorMessage.java | 6 +++--- server/src/com/vaadin/ui/Form.java | 2 +- server/src/com/vaadin/ui/Table.java | 6 +++--- 9 files changed, 15 insertions(+), 28 deletions(-) diff --git a/server/src/com/vaadin/data/Buffered.java b/server/src/com/vaadin/data/Buffered.java index bbfc04b73a..0d6722f71f 100644 --- a/server/src/com/vaadin/data/Buffered.java +++ b/server/src/com/vaadin/data/Buffered.java @@ -151,19 +151,6 @@ public interface Buffered extends Serializable { this.source = source; } - /** - * Creates a source exception from a cause exception. - * - * @param source - * the source object implementing the Buffered interface. - * @param cause - * the original cause for this exception. - */ - public SourceException(Buffered source, Throwable cause) { - this.source = source; - causes = new Throwable[] { cause }; - } - /** * Creates a source exception from multiple causes. * @@ -172,7 +159,7 @@ public interface Buffered extends Serializable { * @param causes * the original causes for this exception. */ - public SourceException(Buffered source, Throwable[] causes) { + public SourceException(Buffered source, Throwable... causes) { this.source = source; this.causes = causes; } diff --git a/server/src/com/vaadin/data/Validator.java b/server/src/com/vaadin/data/Validator.java index c4f008cb39..4f3fbe2cc3 100644 --- a/server/src/com/vaadin/data/Validator.java +++ b/server/src/com/vaadin/data/Validator.java @@ -105,7 +105,7 @@ public interface Validator extends Serializable { * this exception. */ public InvalidValueException(String message, - InvalidValueException[] causes) { + InvalidValueException... causes) { super(message); if (causes == null) { throw new NullPointerException( diff --git a/server/src/com/vaadin/data/util/BeanItem.java b/server/src/com/vaadin/data/util/BeanItem.java index 24eb2505e4..fc51be8f36 100644 --- a/server/src/com/vaadin/data/util/BeanItem.java +++ b/server/src/com/vaadin/data/util/BeanItem.java @@ -141,7 +141,7 @@ public class BeanItem extends PropertysetItem { * @param propertyIds * ids of the properties. */ - public BeanItem(BT bean, String[] propertyIds) { + public BeanItem(BT bean, String... propertyIds) { this(bean, Arrays.asList(propertyIds)); } diff --git a/server/src/com/vaadin/data/util/sqlcontainer/RowId.java b/server/src/com/vaadin/data/util/sqlcontainer/RowId.java index 8fd8eec697..c375bd5a4a 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/RowId.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/RowId.java @@ -34,7 +34,7 @@ public class RowId implements Serializable { protected RowId() { } - public RowId(Object[] id) { + public RowId(Object... id) { if (id == null) { throw new IllegalArgumentException("id parameter must not be null!"); } diff --git a/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java b/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java index fbf53121da..03f7f23fdd 100644 --- a/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java +++ b/server/src/com/vaadin/data/util/sqlcontainer/TemporaryRowId.java @@ -18,7 +18,7 @@ package com.vaadin.data.util.sqlcontainer; public class TemporaryRowId extends RowId { private static final long serialVersionUID = -641983830469018329L; - public TemporaryRowId(Object[] id) { + public TemporaryRowId(Object... id) { super(id); } diff --git a/server/src/com/vaadin/event/ShortcutAction.java b/server/src/com/vaadin/event/ShortcutAction.java index 78eec53112..5ec4d3bfa0 100644 --- a/server/src/com/vaadin/event/ShortcutAction.java +++ b/server/src/com/vaadin/event/ShortcutAction.java @@ -70,7 +70,7 @@ public class ShortcutAction extends Action { * @param m * optional modifier keys */ - public ShortcutAction(String caption, int kc, int[] m) { + public ShortcutAction(String caption, int kc, int... m) { super(caption); keyCode = kc; modifiers = m; @@ -91,7 +91,7 @@ public class ShortcutAction extends Action { * @param m * optional modifier keys */ - public ShortcutAction(String caption, Resource icon, int kc, int[] m) { + public ShortcutAction(String caption, Resource icon, int kc, int... m) { super(caption, icon); keyCode = kc; modifiers = m; @@ -174,7 +174,7 @@ public class ShortcutAction extends Action { * @param shorthandCaption * @param modifierKeys */ - public ShortcutAction(String shorthandCaption, int[] modifierKeys) { + public ShortcutAction(String shorthandCaption, int... modifierKeys) { // && -> & etc super(SHORTHAND_ESCAPE.matcher(shorthandCaption).replaceAll("$1$2$3")); // replace escaped chars with something that won't accidentally match diff --git a/server/src/com/vaadin/server/CompositeErrorMessage.java b/server/src/com/vaadin/server/CompositeErrorMessage.java index 5ae7cfd577..1645285f9b 100644 --- a/server/src/com/vaadin/server/CompositeErrorMessage.java +++ b/server/src/com/vaadin/server/CompositeErrorMessage.java @@ -32,10 +32,10 @@ public class CompositeErrorMessage extends AbstractErrorMessage { * Constructor for CompositeErrorMessage. * * @param errorMessages - * the Array of error messages that are listed togeter. Nulls are - * ignored, but at least one message is required. + * the array of error messages that are listed together. Nulls + * are ignored, but at least one message is required. */ - public CompositeErrorMessage(ErrorMessage[] errorMessages) { + public CompositeErrorMessage(ErrorMessage... errorMessages) { super(null); setErrorLevel(ErrorLevel.INFORMATION); diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java index 9d0bb41cac..706c103cd7 100644 --- a/server/src/com/vaadin/ui/Form.java +++ b/server/src/com/vaadin/ui/Form.java @@ -1131,7 +1131,7 @@ public class Form extends AbstractField implements Item.Editor, * @param visibleProperties * the visibleProperties to set. */ - public void setVisibleItemProperties(Object[] visibleProperties) { + public void setVisibleItemProperties(Object... visibleProperties) { LinkedList v = new LinkedList(); for (int i = 0; i < visibleProperties.length; i++) { v.add(visibleProperties[i]); diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index a688b2eb45..b5606b4e67 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -623,7 +623,7 @@ public class Table extends AbstractSelect implements Action.Container, * @param visibleColumns * the Array of shown property id:s. */ - public void setVisibleColumns(Object[] visibleColumns) { + public void setVisibleColumns(Object... visibleColumns) { // Visible columns must exist if (visibleColumns == null) { @@ -722,7 +722,7 @@ public class Table extends AbstractSelect implements Action.Container, * the Array of column headers that match the * {@link #getVisibleColumns()} method. */ - public void setColumnHeaders(String[] columnHeaders) { + public void setColumnHeaders(String... columnHeaders) { if (columnHeaders.length != visibleColumns.size()) { throw new IllegalArgumentException( @@ -781,7 +781,7 @@ public class Table extends AbstractSelect implements Action.Container, * the Array of icons that match the {@link #getVisibleColumns()} * . */ - public void setColumnIcons(Resource[] columnIcons) { + public void setColumnIcons(Resource... columnIcons) { if (columnIcons.length != visibleColumns.size()) { throw new IllegalArgumentException( -- 2.39.5