aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/main/java/com/vaadin
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-09-28 07:45:09 +0200
committerHenri Sara <henri.sara@gmail.com>2017-09-28 08:45:09 +0300
commit7fd440d2448587f7e9958e84c84ec2bfd30ba8a0 (patch)
treec0186a8d940f07c060fcaf4b03e82271bfa9e5c2 /server/src/main/java/com/vaadin
parentcb91ab76eecbf85ad598fc5054fa2ec5ab3308f6 (diff)
downloadvaadin-framework-7fd440d2448587f7e9958e84c84ec2bfd30ba8a0.tar.gz
vaadin-framework-7fd440d2448587f7e9958e84c84ec2bfd30ba8a0.zip
Use single character for StringBuilder.append (#10102)
Diffstat (limited to 'server/src/main/java/com/vaadin')
-rw-r--r--server/src/main/java/com/vaadin/navigator/Navigator.java2
-rw-r--r--server/src/main/java/com/vaadin/server/ComponentSizeValidator.java31
-rw-r--r--server/src/main/java/com/vaadin/server/JsonPaintTarget.java28
-rw-r--r--server/src/main/java/com/vaadin/server/VaadinServlet.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/AbsoluteLayout.java10
-rw-r--r--server/src/main/java/com/vaadin/ui/GridLayout.java8
-rw-r--r--server/src/main/java/com/vaadin/ui/UI.java4
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java23
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/Design.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java4
-rw-r--r--server/src/main/java/com/vaadin/util/ConnectorHelper.java2
12 files changed, 60 insertions, 58 deletions
diff --git a/server/src/main/java/com/vaadin/navigator/Navigator.java b/server/src/main/java/com/vaadin/navigator/Navigator.java
index d65bad9db7..a21cdbcaac 100644
--- a/server/src/main/java/com/vaadin/navigator/Navigator.java
+++ b/server/src/main/java/com/vaadin/navigator/Navigator.java
@@ -159,7 +159,7 @@ public class Navigator implements Serializable {
if (!ui.getUiRootPath().endsWith("/")) {
// make sure there is a '/' between the root path and the
// navigation state.
- sb.append("/");
+ sb.append('/');
}
sb.append(state);
URI location = ui.getPage().getLocation();
diff --git a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
index f65fc610c9..efbce4eeca 100644
--- a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
+++ b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
@@ -210,7 +210,7 @@ public class ComponentSizeValidator implements Serializable {
public void reportErrors(StringBuilder clientJSON,
PrintStream serverErrorStream) {
- clientJSON.append("{");
+ clientJSON.append('{');
Component parent = component.getParent();
String paintableId = component.getConnectorId();
@@ -282,16 +282,16 @@ public class ComponentSizeValidator implements Serializable {
boolean first = true;
for (InvalidLayout subError : subErrors) {
if (!first) {
- clientJSON.append(",");
+ clientJSON.append(',');
} else {
first = false;
}
subError.reportErrors(clientJSON, serverErrorStream);
}
- clientJSON.append("]");
+ clientJSON.append(']');
serverErrorStream.println("<< Sub erros");
}
- clientJSON.append("}");
+ clientJSON.append('}');
}
}
@@ -385,7 +385,7 @@ public class ComponentSizeValidator implements Serializable {
err.append("- ");
err.append(component.getClass().getSimpleName());
- err.append("/").append(Integer.toHexString(component.hashCode()));
+ err.append('/').append(Integer.toHexString(component.hashCode()));
if (component.getCaption() != null) {
err.append(" \"");
@@ -399,8 +399,8 @@ public class ComponentSizeValidator implements Serializable {
}
if (createLoc != null) {
- err.append(", created at (").append(createLoc.file).append(":")
- .append(createLoc.lineNumber).append(")");
+ err.append(", created at (").append(createLoc.file).append(':')
+ .append(createLoc.lineNumber).append(')');
}
@@ -408,11 +408,11 @@ public class ComponentSizeValidator implements Serializable {
err.append(" (");
err.append(attribute);
if (sizeLoc != null) {
- err.append(", set at (").append(sizeLoc.file).append(":")
- .append(sizeLoc.lineNumber).append(")");
+ err.append(", set at (").append(sizeLoc.file).append(':')
+ .append(sizeLoc.lineNumber).append(')');
}
- err.append(")");
+ err.append(')');
}
err.append("\n");
@@ -452,10 +452,9 @@ public class ComponentSizeValidator implements Serializable {
} else if (parent instanceof GridLayout) {
GridLayout gl = (GridLayout) parent;
Area componentArea = gl.getComponentArea(component);
- for (int row = componentArea.getRow1();
- row <= componentArea.getRow2(); row++) {
- for (int column = 0;
- column < gl.getColumns(); column++) {
+ for (int row = componentArea.getRow1(); row <= componentArea
+ .getRow2(); row++) {
+ for (int column = 0; column < gl.getColumns(); column++) {
Component c = gl.getComponent(column, row);
if (c != null) {
if (!hasRelativeHeight(c)) {
@@ -560,8 +559,8 @@ public class ComponentSizeValidator implements Serializable {
} else if (parent instanceof GridLayout) {
GridLayout gl = (GridLayout) parent;
Area componentArea = gl.getComponentArea(component);
- for (int col = componentArea.getColumn1();
- col <= componentArea.getColumn2(); col++) {
+ for (int col = componentArea.getColumn1(); col <= componentArea
+ .getColumn2(); col++) {
for (int row = 0; row < gl.getRows(); row++) {
Component c = gl.getComponent(col, row);
if (c != null) {
diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
index 3be04fc2c4..3fef4926d3 100644
--- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
+++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
@@ -408,7 +408,7 @@ public class JsonPaintTarget implements PaintTarget {
sb.append("\"");
sb.append(name);
sb.append("\":");
- sb.append("{");
+ sb.append('{');
for (Iterator<?> it = value.keySet().iterator(); it.hasNext();) {
Object key = it.next();
Object mapValue = value.get(key);
@@ -429,10 +429,10 @@ public class JsonPaintTarget implements PaintTarget {
sb.append("\"");
}
if (it.hasNext()) {
- sb.append(",");
+ sb.append(',');
}
}
- sb.append("}");
+ sb.append('}');
tag.addAttribute(sb.toString());
}
@@ -448,13 +448,13 @@ public class JsonPaintTarget implements PaintTarget {
buf.append("\"").append(name).append("\":[");
for (int i = 0; i < values.length; i++) {
if (i > 0) {
- buf.append(",");
+ buf.append(',');
}
buf.append("\"");
buf.append(escapeJSON(values[i].toString()));
buf.append("\"");
}
- buf.append("]");
+ buf.append(']');
tag.addAttribute(buf.toString());
}
@@ -753,7 +753,7 @@ public class JsonPaintTarget implements PaintTarget {
data.append(attributesAsJsonObject());
data.append(getData());
// Writes the end (closing) tag
- data.append("]");
+ data.append(']');
tagClosed = true;
}
}
@@ -774,7 +774,7 @@ public class JsonPaintTarget implements PaintTarget {
}
public void closeChildrenArray() {
- // append("]");
+ // append(']');
// firstField = false;
}
@@ -821,17 +821,17 @@ public class JsonPaintTarget implements PaintTarget {
private String attributesAsJsonObject() {
final StringBuilder buf = new StringBuilder();
buf.append(startField());
- buf.append("{");
+ buf.append('{');
for (final Iterator<Object> iter = attr.iterator(); iter
.hasNext();) {
final String element = (String) iter.next();
buf.append(element);
if (iter.hasNext()) {
- buf.append(",");
+ buf.append(',');
}
}
buf.append(tag.variablesAsJsonObject());
- buf.append("}");
+ buf.append('}');
return buf.toString();
}
@@ -851,10 +851,10 @@ public class JsonPaintTarget implements PaintTarget {
final Variable element = (Variable) iter.next();
buf.append(element.getJsonPresentation());
if (iter.hasNext()) {
- buf.append(",");
+ buf.append(',');
}
}
- buf.append("}");
+ buf.append('}');
return buf.toString();
}
}
@@ -972,10 +972,10 @@ public class JsonPaintTarget implements PaintTarget {
sb.append("\"");
i++;
if (i < value.length) {
- sb.append(",");
+ sb.append(',');
}
}
- sb.append("]");
+ sb.append(']');
return sb.toString();
}
}
diff --git a/server/src/main/java/com/vaadin/server/VaadinServlet.java b/server/src/main/java/com/vaadin/server/VaadinServlet.java
index edfbd1cc28..fff04caf45 100644
--- a/server/src/main/java/com/vaadin/server/VaadinServlet.java
+++ b/server/src/main/java/com/vaadin/server/VaadinServlet.java
@@ -1510,7 +1510,7 @@ public class VaadinServlet extends HttpServlet implements Constants {
} else {
safe.append("&#");
safe.append((int) c);
- safe.append(";");
+ safe.append(';');
}
}
diff --git a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java
index beedc52a45..58e937e8a2 100644
--- a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java
+++ b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java
@@ -676,20 +676,20 @@ public class AbsoluteLayout extends AbstractLayout
Component newChild = designContext.readDesign(childComponent);
StringBuilder css = new StringBuilder();
if (attr.hasKey(ATTR_TOP)) {
- css.append("top:").append(attr.get(ATTR_TOP)).append(";");
+ css.append("top:").append(attr.get(ATTR_TOP)).append(';');
}
if (attr.hasKey(ATTR_RIGHT)) {
- css.append("right:").append(attr.get(ATTR_RIGHT)).append(";");
+ css.append("right:").append(attr.get(ATTR_RIGHT)).append(';');
}
if (attr.hasKey(ATTR_BOTTOM)) {
- css.append("bottom:").append(attr.get(ATTR_BOTTOM)).append(";");
+ css.append("bottom:").append(attr.get(ATTR_BOTTOM)).append(';');
}
if (attr.hasKey(ATTR_LEFT)) {
- css.append("left:").append(attr.get(ATTR_LEFT)).append(";");
+ css.append("left:").append(attr.get(ATTR_LEFT)).append(';');
}
if (attr.hasKey(ATTR_Z_INDEX)) {
css.append("z-index:").append(attr.get(ATTR_Z_INDEX))
- .append(";");
+ .append(';');
}
addComponent(newChild, css.toString());
}
diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java
index cc043927e9..b4d97018ce 100644
--- a/server/src/main/java/com/vaadin/ui/GridLayout.java
+++ b/server/src/main/java/com/vaadin/ui/GridLayout.java
@@ -652,14 +652,14 @@ public class GridLayout extends AbstractLayout
sb.append(component.getCaption());
sb.append("\"");
}
- sb.append(")");
+ sb.append(')');
sb.append(" is already added to ");
sb.append(existingArea.childData.column1);
- sb.append(",");
+ sb.append(',');
sb.append(existingArea.childData.column1);
- sb.append(",");
+ sb.append(',');
sb.append(existingArea.childData.row1);
- sb.append(",");
+ sb.append(',');
sb.append(existingArea.childData.row2);
sb.append("(column1, column2, row1, row2).");
diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java
index 5d27c1de74..e8b9198111 100644
--- a/server/src/main/java/com/vaadin/ui/UI.java
+++ b/server/src/main/java/com/vaadin/ui/UI.java
@@ -214,13 +214,13 @@ public abstract class UI extends AbstractSingleComponentContainer
.validateLayouts(UI.this);
StringBuilder json = new StringBuilder();
json.append("{\"invalidLayouts\":");
- json.append("[");
+ json.append('[');
if (invalidSizes != null) {
boolean first = true;
for (InvalidLayout invalidSize : invalidSizes) {
if (!first) {
- json.append(",");
+ json.append(',');
} else {
first = false;
}
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java b/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java
index 128e8bcb97..cf5051abb4 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java
@@ -61,14 +61,15 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
/**
* Default drag data generator for Grid. It creates a list of row values
* separated by a tabulator character ({@code \t}).
+ *
* <pre>
- * "column1_value\tcolumn2_value\t ... columnN_value"
+ * "column1_value\tcolumn2_value\t ... columnN_value"
* </pre>
*/
private final SerializableFunction<T, String> defaultGridGenerator = item -> {
StringBuilder generatedValue = new StringBuilder();
getParent().getColumns().forEach(column -> {
- generatedValue.append("\t"); // Tab separated values
+ generatedValue.append("\t"); // Tab separated values
generatedValue.append(column.getValueProvider().apply(item));
});
return generatedValue.substring(1);
@@ -92,8 +93,8 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
generatorFunctions = new HashMap<>();
// Set default generator function for "text" parameter
- generatorFunctions
- .put(DragSourceState.DATA_TYPE_TEXT, defaultGridGenerator);
+ generatorFunctions.put(DragSourceState.DATA_TYPE_TEXT,
+ defaultGridGenerator);
}
@Override
@@ -163,6 +164,7 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* type} data.
* <p>
* Example, building a JSON object that contains the item's values:
+ *
* <pre>
* dragSourceExtension.setDragDataGenerator("application/json", item ->
* {
@@ -181,12 +183,13 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* </pre>
*
* @param type
- * Type of the generated data. The generated value will be
- * accessible during drop using this type.
+ * Type of the generated data. The generated value will be
+ * accessible during drop using this type.
* @param generator
- * Function to be executed on row data generation.
+ * Function to be executed on row data generation.
*/
- public void setDragDataGenerator(String type, SerializableFunction<T, String> generator) {
+ public void setDragDataGenerator(String type,
+ SerializableFunction<T, String> generator) {
generatorFunctions.put(type, generator);
}
@@ -194,7 +197,7 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* Remove the generator function set for the given type.
*
* @param type
- * Type of the generator to be removed.
+ * Type of the generator to be removed.
*/
public void clearDragDataGenerator(String type) {
generatorFunctions.remove(type);
@@ -204,7 +207,7 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> {
* Returns the drag data generator function for the given type.
*
* @param type
- * Type of the generated data.
+ * Type of the generated data.
* @return Drag data generator function for the given type.
*/
public SerializableFunction<T, String> getDragDataGenerator(String type) {
diff --git a/server/src/main/java/com/vaadin/ui/declarative/Design.java b/server/src/main/java/com/vaadin/ui/declarative/Design.java
index 78288737a0..761ce3c355 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/Design.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java
@@ -302,7 +302,7 @@ public class Design implements Serializable {
Character c = className.charAt(i);
if (Character.isUpperCase(c)) {
if (i > 0) {
- result.append("-");
+ result.append('-');
}
result.append(Character.toLowerCase(c));
} else {
diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
index cdf0c6aaee..5b5887316c 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java
@@ -328,7 +328,7 @@ public class DesignAttributeHandler implements Serializable {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < words.length; i++) {
if (builder.length() != 0) {
- builder.append("-");
+ builder.append('-');
}
builder.append(words[i].toLowerCase());
}
diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java
index aade7e80b7..63f509c9ce 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java
@@ -166,13 +166,13 @@ public class DesignShortcutActionConverter
// handle modifiers
if (value.getModifiers() != null) {
for (int modifier : value.getModifiers()) {
- sb.append(getStringForKeycode(modifier)).append("-");
+ sb.append(getStringForKeycode(modifier)).append('-');
}
}
// handle keycode
sb.append(getStringForKeycode(value.getKeyCode()));
if (value.getCaption() != null) {
- sb.append(" ").append(value.getCaption());
+ sb.append(' ').append(value.getCaption());
}
return sb.toString();
}
diff --git a/server/src/main/java/com/vaadin/util/ConnectorHelper.java b/server/src/main/java/com/vaadin/util/ConnectorHelper.java
index 46b4ba4bf1..480724ae5e 100644
--- a/server/src/main/java/com/vaadin/util/ConnectorHelper.java
+++ b/server/src/main/java/com/vaadin/util/ConnectorHelper.java
@@ -92,7 +92,7 @@ public class ConnectorHelper {
topClass = topClass.getEnclosingClass();
}
builder.append(connectorClass.getName());
- builder.append("(");
+ builder.append('(');
builder.append(topClass.getSimpleName());
builder.append(".java:1)");
}