diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-10 12:06:27 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-10-10 13:06:27 +0300 |
commit | ab18b6c58ef819dbc0049c4713cf06209d5abc47 (patch) | |
tree | 84aec85fe2dbeae4b9b340481c5a18228c4ec296 /compatibility-server | |
parent | 802bb98b851ab9b15617b283ccdba3dbc517ada6 (diff) | |
download | vaadin-framework-ab18b6c58ef819dbc0049c4713cf06209d5abc47.tar.gz vaadin-framework-ab18b6c58ef819dbc0049c4713cf06209d5abc47.zip |
Remove unneeded .toString() (#10141)
Diffstat (limited to 'compatibility-server')
11 files changed, 32 insertions, 38 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertyFormatter.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertyFormatter.java index 2e1ac13e9a..223cf15098 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertyFormatter.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertyFormatter.java @@ -31,7 +31,7 @@ import com.vaadin.v7.data.util.converter.Converter; * For example <code> * <pre>textfield.setPropertyDataSource(new PropertyFormatter(property) { public String format(Object value) { - return ((Double) value).toString() + "000000000"; + return ((Double) value) + "000000000"; } public Object parse(String formattedValue) throws Exception { @@ -223,7 +223,7 @@ public abstract class PropertyFormatter<T> extends AbstractProperty<String> } } else { try { - dataSource.setValue(parse(newValue.toString())); + dataSource.setValue(parse(newValue)); if (!newValue.equals(getValue())) { fireValueChange(); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/TextFileProperty.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/TextFileProperty.java index 3dea636644..52065485e5 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/TextFileProperty.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/TextFileProperty.java @@ -145,7 +145,7 @@ public class TextFileProperty extends AbstractProperty<String> { ? new OutputStreamWriter(fos) : new OutputStreamWriter(fos, charset); BufferedWriter w = new BufferedWriter(osw); - w.append(newValue.toString()); + w.append(newValue); w.flush(); w.close(); osw.close(); diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java index 3cb4103521..78ef1f8d58 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java @@ -127,13 +127,13 @@ public final class RowItem implements Item { public String toString() { StringBuilder s = new StringBuilder(); s.append("ID:"); - s.append(getId().toString()); + s.append(getId()); for (Object propId : getItemPropertyIds()) { s.append('|'); - s.append(propId.toString()); + s.append(propId); s.append(':'); Object value = getItemProperty(propId).getValue(); - s.append((null != value) ? value.toString() : null); + s.append(value); } return s.toString(); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/MSSQLGenerator.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/MSSQLGenerator.java index fa607aeb5a..6385ad0767 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/MSSQLGenerator.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/query/generator/MSSQLGenerator.java @@ -112,7 +112,7 @@ public class MSSQLGenerator extends DefaultSQLGenerator { query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); } query.append(") AS a WHERE a.rownum BETWEEN ").append(offset) - .append(" AND ").append(Integer.toString(offset + pagelength)); + .append(" AND ").append(offset + pagelength); sh.setQueryString(query.toString()); return sh; } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java index 305859534a..aeb6d8154e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractTextField.java @@ -442,9 +442,9 @@ public abstract class AbstractTextField extends AbstractField<String> implements lastKnownTextContent = getNullRepresentation(); textChangeEventPending = true; } else if (newValue != null - && !newValue.toString().equals(lastKnownTextContent)) { + && !newValue.equals(lastKnownTextContent)) { // Value was changed to something else than null representation - lastKnownTextContent = newValue.toString(); + lastKnownTextContent = newValue; textChangeEventPending = true; } firePendingTextChangeEvent(); @@ -652,7 +652,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements * @since 6.4 */ public void selectAll() { - String text = getValue() == null ? "" : getValue().toString(); + String text = getValue() == null ? "" : getValue(); setSelectionRange(0, text.length()); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java index 747a0eea51..2e797cb7a9 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java @@ -861,7 +861,7 @@ public class Form extends AbstractField<Object> final Field<?> oldField = fields.get(propertyId); if (oldField == null) { throw new IllegalArgumentException("Field with given propertyid '" - + propertyId.toString() + "' can not be found."); + + propertyId + "' can not be found."); } final Object value = oldField.getPropertyDataSource() == null ? oldField.getValue() @@ -890,16 +890,14 @@ public class Form extends AbstractField<Object> if (!found) { throw new IllegalArgumentException( "Currently selected value '" + val - + "' of property '" - + propertyId.toString() + + "' of property '" + propertyId + "' was not found"); } } isMultiselect = true; } else { - throw new IllegalArgumentException( - "Current value '" + value + "' of property '" - + propertyId.toString() + "' was not found"); + throw new IllegalArgumentException("Current value '" + value + + "' of property '" + propertyId + "' was not found"); } } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java index 9e8dd1086c..ded75d0755 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java @@ -5265,13 +5265,11 @@ public class Grid extends AbstractComponent addColumnProperty(propertyId, String.class, ""); } else { if (columns.containsKey(propertyId)) { - throw new IllegalStateException( - "A column for property id '" + propertyId.toString() - + "' already exists in this grid"); + throw new IllegalStateException("A column for property id '" + + propertyId + "' already exists in this grid"); } else { - throw new IllegalStateException( - "Property id '" + propertyId.toString() - + "' does not exist in the container"); + throw new IllegalStateException("Property id '" + propertyId + + "' does not exist in the container"); } } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/DateRenderer.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/DateRenderer.java index 95e22919ae..f6c1d87f93 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/DateRenderer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/DateRenderer.java @@ -231,7 +231,7 @@ public class DateRenderer extends AbstractRenderer<Date> { public String toString() { final String fieldInfo; if (dateFormat != null) { - fieldInfo = "dateFormat: " + dateFormat.toString(); + fieldInfo = "dateFormat: " + dateFormat; } else { fieldInfo = "locale: " + locale + ", formatString: " + formatString; } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/NumberRenderer.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/NumberRenderer.java index 871657411a..7a00fcc26c 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/NumberRenderer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/renderers/NumberRenderer.java @@ -180,9 +180,9 @@ public class NumberRenderer extends AbstractRenderer<Number> { } else if (numberFormat != null) { stringValue = numberFormat.format(value); } else { - throw new IllegalStateException(String.format( - "Internal bug: " + "%s is in an illegal state: " - + "[locale: %s, numberFormat: %s, formatString: %s]", + throw new IllegalStateException(String.format("Internal bug: " + + "%s is in an illegal state: " + + "[locale: %s, numberFormat: %s, formatString: %s]", getClass().getSimpleName(), locale, numberFormat, formatString)); } @@ -193,7 +193,7 @@ public class NumberRenderer extends AbstractRenderer<Number> { public String toString() { final String fieldInfo; if (numberFormat != null) { - fieldInfo = "numberFormat: " + numberFormat.toString(); + fieldInfo = "numberFormat: " + numberFormat; } else { fieldInfo = "locale: " + locale + ", formatString: " + formatString; } diff --git a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/FreeformQueryUtil.java b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/FreeformQueryUtil.java index 9c14296476..ab12cc9f7b 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/FreeformQueryUtil.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/data/util/sqlcontainer/FreeformQueryUtil.java @@ -27,7 +27,7 @@ public class FreeformQueryUtil { QueryBuilder.getWhereStringForFilters(filters, sh)); } query.append(") AS a WHERE a.rownum BETWEEN ").append(offset) - .append(" AND ").append(Integer.toString(offset + limit)); + .append(" AND ").append(offset + limit); sh.setQueryString(query.toString()); return sh; } else if (SQLTestsConstants.db == DB.ORACLE) { diff --git a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeTestBase.java b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeTestBase.java index a01e8dadce..5d4458f286 100644 --- a/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeTestBase.java +++ b/compatibility-server/src/test/java/com/vaadin/v7/tests/server/component/grid/declarative/GridDeclarativeTestBase.java @@ -17,8 +17,6 @@ package com.vaadin.v7.tests.server.component.grid.declarative; import java.util.List; -import org.junit.Assert; - import com.vaadin.tests.design.DeclarativeTestBase; import com.vaadin.v7.ui.Grid; import com.vaadin.v7.ui.Grid.Column; @@ -54,8 +52,8 @@ public class GridDeclarativeTestBase extends DeclarativeTestBase<Grid> { } private void compareHeaders(Grid expected, Grid actual) { - assertEquals("Different header row count", - expected.getHeaderRowCount(), actual.getHeaderRowCount()); + assertEquals("Different header row count", expected.getHeaderRowCount(), + actual.getHeaderRowCount()); for (int i = 0; i < expected.getHeaderRowCount(); ++i) { HeaderRow expectedRow = expected.getHeaderRow(i); HeaderRow actualRow = actual.getHeaderRow(i); @@ -66,8 +64,8 @@ public class GridDeclarativeTestBase extends DeclarativeTestBase<Grid> { } for (Column c : expected.getColumns()) { - String baseError = "Difference when comparing cell for " - + c.toString() + " on header row " + i + ": "; + String baseError = "Difference when comparing cell for " + c + + " on header row " + i + ": "; Object propertyId = c.getPropertyId(); HeaderCell expectedCell = expectedRow.getCell(propertyId); HeaderCell actualCell = actualRow.getCell(propertyId); @@ -92,15 +90,15 @@ public class GridDeclarativeTestBase extends DeclarativeTestBase<Grid> { } private void compareFooters(Grid expected, Grid actual) { - assertEquals("Different footer row count", - expected.getFooterRowCount(), actual.getFooterRowCount()); + assertEquals("Different footer row count", expected.getFooterRowCount(), + actual.getFooterRowCount()); for (int i = 0; i < expected.getFooterRowCount(); ++i) { FooterRow expectedRow = expected.getFooterRow(i); FooterRow actualRow = actual.getFooterRow(i); for (Column c : expected.getColumns()) { - String baseError = "Difference when comparing cell for " - + c.toString() + " on footer row " + i + ": "; + String baseError = "Difference when comparing cell for " + c + + " on footer row " + i + ": "; Object propertyId = c.getPropertyId(); FooterCell expectedCell = expectedRow.getCell(propertyId); FooterCell actualCell = actualRow.getCell(propertyId); |