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 /server/src/main/java/com/vaadin | |
parent | 802bb98b851ab9b15617b283ccdba3dbc517ada6 (diff) | |
download | vaadin-framework-ab18b6c58ef819dbc0049c4713cf06209d5abc47.tar.gz vaadin-framework-ab18b6c58ef819dbc0049c4713cf06209d5abc47.zip |
Remove unneeded .toString() (#10141)
Diffstat (limited to 'server/src/main/java/com/vaadin')
9 files changed, 31 insertions, 31 deletions
diff --git a/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java index b60cca189d..f10b246c5c 100644 --- a/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java +++ b/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java @@ -166,7 +166,7 @@ public class AtmospherePushConnection implements PushConnection { try { Writer writer = new StringWriter(); new UidlWriter().write(getUI(), writer, async); - sendMessage("for(;;);[{" + writer.toString() + "}]"); + sendMessage("for(;;);[{" + writer + "}]"); } catch (Exception e) { throw new RuntimeException("Push failed", e); } @@ -230,8 +230,8 @@ public class AtmospherePushConnection implements PushConnection { /** * Associates this {@link AtmospherePushConnection} with the given - * {@link AtmosphereResource} representing an established push connection. If - * already connected, calls {@link #disconnect()} first. If there is a + * {@link AtmosphereResource} representing an established push connection. + * If already connected, calls {@link #disconnect()} first. If there is a * deferred push, carries it out via the new connection. * * @since 7.2 diff --git a/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java index 428e436399..32bc3c8e1d 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java @@ -323,9 +323,8 @@ public abstract class AbstractSingleComponentContainer extends AbstractComponent protected void readDesignChildren(Elements children, DesignContext context) { if (children.size() > 1) { - throw new DesignException( - "The container of type " + getClass().toString() - + " can have only one child component."); + throw new DesignException("The container of type " + getClass() + + " can have only one child component."); } else if (children.size() == 1) { setContent(context.readDesign(children.first())); } diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java index 00d735f839..6e03ed35e9 100644 --- a/server/src/main/java/com/vaadin/ui/ComboBox.java +++ b/server/src/main/java/com/vaadin/ui/ComboBox.java @@ -704,7 +704,7 @@ public class ComboBox<T> extends AbstractSingleSelect<T> private void updateSelectedItemCaption() { String selectedCaption = null; - T value = getDataCommunicator().getKeyMapper().get(getSelectedKey()); + T value = keyToItem(getSelectedKey()); if (value != null) { selectedCaption = getItemCaptionGenerator().apply(value); } @@ -713,7 +713,7 @@ public class ComboBox<T> extends AbstractSingleSelect<T> private void updateSelectedItemIcon() { String selectedItemIcon = null; - T value = getDataCommunicator().getKeyMapper().get(getSelectedKey()); + T value = keyToItem(getSelectedKey()); if (value != null) { Resource icon = getItemIconGenerator().apply(value); if (icon != null) { @@ -772,9 +772,8 @@ public class ComboBox<T> extends AbstractSingleSelect<T> ((DeclarativeStyleGenerator) styleGenerator).setStyle(item, child.attr("style")); } else { - throw new IllegalStateException(String.format( - "Don't know how " - + "to set style using current style generator '%s'", + throw new IllegalStateException(String.format("Don't know how " + + "to set style using current style generator '%s'", styleGenerator.getClass().getName())); } } diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index a80e8f1729..993a6d3411 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -2540,9 +2540,9 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, if (!renderer.getPresentationType() .isAssignableFrom(definition.getType())) { - throw new IllegalArgumentException(renderer.toString() - + " cannot be used with a property of type " - + definition.getType().getName()); + throw new IllegalArgumentException( + renderer + " cannot be used with a property of type " + + definition.getType().getName()); } @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -4259,7 +4259,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, protected T deserializeDeclarativeRepresentation(String item) { if (item == null) { return super.deserializeDeclarativeRepresentation( - new String(UUID.randomUUID().toString())); + UUID.randomUUID().toString()); } return super.deserializeDeclarativeRepresentation(new String(item)); } diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java index ae02df9c70..db659a5229 100644 --- a/server/src/main/java/com/vaadin/ui/UI.java +++ b/server/src/main/java/com/vaadin/ui/UI.java @@ -544,8 +544,7 @@ public abstract class UI extends AbstractSingleComponentContainer if (session == null) { return null; } else { - return session.toString() + " for " - + session.getService().getServiceName(); + return session + " for " + session.getService().getServiceName(); } } diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java index 61510dfee6..86f82c5abd 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java @@ -402,8 +402,8 @@ public class DesignContext implements Serializable { String contentString = attributes.get("content"); String[] parts = contentString.split(":"); if (parts.length != 2) { - throw new DesignException("The meta tag '" - + child.toString() + "' cannot be parsed."); + throw new DesignException("The meta tag '" + child + + "' cannot be parsed."); } String prefixName = parts[0]; String packageName = parts[1]; diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index f1a4fcde23..d3d2b13170 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -47,8 +47,9 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; @SuppressWarnings("serial") public class DesignResourceConverter implements Converter<String, Resource> { - private static final Map<Integer, VaadinIcons> CODE_POINTS = - Arrays.stream(VaadinIcons.values()).collect(Collectors.toMap(VaadinIcons::getCodepoint, icon -> icon)); + private static final Map<Integer, VaadinIcons> CODE_POINTS = Arrays + .stream(VaadinIcons.values()) + .collect(Collectors.toMap(VaadinIcons::getCodepoint, icon -> icon)); @Override public Result<Resource> convertToModel(String value, ValueContext context) { @@ -115,7 +116,9 @@ public class DesignResourceConverter implements Converter<String, Resource> { return CODE_POINTS.get(codepoint); } - if (FontAwesome.FONT_FAMILY.equals(familyAndCode[0])) { //Left for compatibility + if (FontAwesome.FONT_FAMILY.equals(familyAndCode[0])) { // Left + // for + // compatibility return FontAwesome.fromCodepoint(codepoint); } // all vaadin icons should have a codepoint @@ -144,9 +147,8 @@ public class DesignResourceConverter implements Converter<String, Resource> { @Override public String format(Resource value) { - throw new UnsupportedOperationException( - "Use " + ResourceConverterByProtocol.FONTICON.toString() - + " instead"); + throw new UnsupportedOperationException("Use " + + ResourceConverterByProtocol.FONTICON + " instead"); } }, FILE { @@ -168,7 +170,8 @@ public class DesignResourceConverter implements Converter<String, Resource> { }; - public static final String VAADIN_ICONS_NAME = VaadinIcons.ABACUS.getFontFamily(); + public static final String VAADIN_ICONS_NAME = VaadinIcons.ABACUS + .getFontFamily(); @Override public Resource parse(String value) { diff --git a/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java index 484f88e882..1971540cb2 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java @@ -230,7 +230,7 @@ public class DateRenderer extends AbstractRenderer<Object, 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/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java index 17730901ff..8e00c44ebd 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java @@ -179,9 +179,9 @@ public class NumberRenderer extends AbstractRenderer<Object, 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)); } @@ -192,7 +192,7 @@ public class NumberRenderer extends AbstractRenderer<Object, Number> { public String toString() { final String fieldInfo; if (numberFormat != null) { - fieldInfo = "numberFormat: " + numberFormat.toString(); + fieldInfo = "numberFormat: " + numberFormat; } else { fieldInfo = "locale: " + locale + ", formatString: " + formatString; } |