Skip to content

Commit

Permalink
Merge pull request #3174 from FOCONIS/more-char-append
Browse files Browse the repository at this point in the history
Use char-append instead of String-append
  • Loading branch information
rbygrave authored Aug 21, 2023
2 parents caf8bd0 + dede93c commit e09265f
Show file tree
Hide file tree
Showing 58 changed files with 123 additions and 123 deletions.
4 changes: 2 additions & 2 deletions ebean-api/src/main/java/io/ebean/StdOperators.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public static Property<String> concat(Property<?> property, Object... values) {
StringBuilder expression = new StringBuilder(50);
expression.append("concat(").append(property.toString());
for (Object value : values) {
expression.append(",").append(sqlConcatString(value));
expression.append(',').append(sqlConcatString(value));
}
expression.append(")");
expression.append(')');
return Property.of(expression.toString());
}

Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/cache/TenantAwareKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public boolean equals(Object obj) {
public String toString() {
StringBuilder sb = new StringBuilder(key.toString());
if (tenantId != null) {
sb.append(":").append(tenantId);
sb.append(':').append(tenantId);
}
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ protected boolean hasInheritance(Class<?> supCls) {
public TableName getM2MJoinTableName(TableName lhsTable, TableName rhsTable) {
StringBuilder buffer = new StringBuilder();
buffer.append(unQuote(lhsTable.getName()));
buffer.append("_");
buffer.append('_');

String rhsTableName = unQuote(rhsTable.getName());
if (rhsTableName.indexOf('_') < rhsPrefixLength) {
Expand Down Expand Up @@ -271,10 +271,10 @@ protected TableName getTableNameFromAnnotation(Class<?> beanClass) {
public String getTableName(String catalog, String schema, String name) {
StringBuilder sb = new StringBuilder();
if (!isNull(catalog)) {
sb.append(quoteIdentifiers(catalog)).append(".");
sb.append(quoteIdentifiers(catalog)).append('.');
}
if (!isNull(schema)) {
sb.append(quoteIdentifiers(schema)).append(".");
sb.append(quoteIdentifiers(schema)).append('.');
}
return sb.append(quoteIdentifiers(name)).toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ protected String joinColumnNames(String[] columns) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < columns.length; i++) {
if (i > 0) {
sb.append("_");
sb.append('_');
}
sb.append(normaliseColumn(columns[i]));
}
Expand Down
4 changes: 2 additions & 2 deletions ebean-api/src/main/java/io/ebean/config/TableName.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ public String getQualifiedName() {
// Add schema
if (schema != null) {
if (buffer.length() > 0) {
buffer.append(".");
buffer.append('.');
}
buffer.append(schema);
}
if (buffer.length() > 0) {
buffer.append(".");
buffer.append('.');
}
return buffer.append(name).toString();
}
Expand Down
14 changes: 7 additions & 7 deletions ebean-api/src/main/java/io/ebean/meta/MetricsAsJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,41 +118,41 @@ private void end() throws IOException {

private void objStart() throws IOException {
objKeyCounter = 0;
writer.append("{");
writer.append('{');
}

private void objEnd() throws IOException {
writer.append("}");
writer.append('}');
}

private void listStart() throws IOException {
listCounter = 0;
writer.append("[");
writer.append('[');
writer.append(newLine);
}

private void listEnd() throws IOException {
writer.append("]");
writer.append(']');
}

private void key(String key) throws IOException {
if (objKeyCounter++ > 0) {
writer.append(", ");
}
writer.append("\"").append(key).append("\":");
writer.append('"').append(key).append("\":");
}

private void val(long count) throws IOException {
writer.append(Long.toString(count));
}

private void val(String val) throws IOException {
writer.append("\"").append(val).append("\"");
writer.append('"').append(val).append('"');
}

private void metricStart(MetaMetric metric) throws IOException {
if (listCounter++ > 0) {
writer.append(",").append(newLine);
writer.append(',').append(newLine);
}
objStart();
key("name");
Expand Down
2 changes: 1 addition & 1 deletion ebean-api/src/main/java/io/ebean/text/PathProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public String getPropertiesAsString() {
sb.append(it.next());
hasNext = it.hasNext();
if (hasNext) {
sb.append(",");
sb.append(',');
}
}
return sb.toString();
Expand Down
4 changes: 2 additions & 2 deletions ebean-api/src/main/java/io/ebean/util/CamelCaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public static String toUnderscoreFromCamel(String camelCase, boolean digitsCompr
lastUpper = i;
} else if (Character.isDigit(c)) {
if (i > lastUpper + 1 && !digitsCompressed) {
sb.append("_");
sb.append('_');
lastUpper = i;
}
sb.append(c);

} else if (Character.isUpperCase(c)) {
if (i > lastUpper + 1) {
sb.append("_");
sb.append('_');
}
sb.append(Character.toLowerCase(c));
lastUpper = i;
Expand Down
4 changes: 2 additions & 2 deletions ebean-core/src/main/java/io/ebeaninternal/api/BindParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ public void buildQueryPlanHash(StringBuilder builder) {
for (Param param : positionedParameters) {
tempBindCount = param.queryBindCount();
bc += tempBindCount;
builder.append("p").append(bc).append(" ?:").append(tempBindCount).append(",");
builder.append('p').append(bc).append(" ?:").append(tempBindCount).append(',');
}

for (Map.Entry<String, Param> entry : namedParameters.entrySet()) {
tempBindCount = entry.getValue().queryBindCount();
bc += tempBindCount;
builder.append("n").append(bc).append(" k:").append(entry.getKey()).append(" ?:").append(tempBindCount).append(",");
builder.append('n').append(bc).append(" k:").append(entry.getKey()).append(" ?:").append(tempBindCount).append(',');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ private SqlUpdate setParamWithBindExpansion(int position, Collection<?> values,
int offset = 0;
for (Object val : values) {
if (offset > 0) {
sqlExpand.append(",");
sqlExpand.append(',');
}
sqlExpand.append("?");
sqlExpand.append('?');
bindParams.setParameter(position + offset++, val);
}
bindExpansion += (offset - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private String calculateNaturalKey(CachedBeanData beanData) {
if (val == null) {
return null;
}
sb.append(val).append(";");
sb.append(val).append(';');
}
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public boolean matchMultiProperties(Set<String> expressionProperties) {
public String calculateKey(Map<String, Object> map) {
StringBuilder sb = new StringBuilder();
for (BeanProperty prop : props) {
sb.append(prop.naturalKeyVal(map)).append(";");
sb.append(prop.naturalKeyVal(map)).append(';');
}
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void visitOneImported(BeanPropertyAssocOne<?> p) {

@Override
public void visitScalar(BeanProperty p, boolean allowNonNull) {
sb.append(",").append(p.dbColumn());
sb.append(',').append(p.dbColumn());
colCount++;
}

Expand Down Expand Up @@ -166,7 +166,7 @@ SpiSqlUpdate deleteByParentIdList(List<Object> parentIds) {
private void appendBind(StringBuilder sb, int count, boolean skipComma) {
for (int i = 0; i < count; i++) {
if (!skipComma || i > 0) {
sb.append(",");
sb.append(',');
}
sb.append('?');
}
Expand Down Expand Up @@ -261,7 +261,7 @@ private String initExportedBindProto() {
return "?";
}
final var sb = new StringBuilder(exportedProperties.length * 2 + 2);
sb.append("(");
sb.append('(');
for (int i = 0; i < exportedProperties.length; i++) {
if (i > 0) {
sb.append(',');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ String path(int pos) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < pos; i++) {
if (i > 0) {
sb.append(".");
sb.append('.');
}
sb.append(paths[i]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public String getForeignDbColumn() {
public void appendWhere(StringBuilder sb, String alias, String path) {
sb.append(alias).append(foreignDbColumn).append(" = ");
if (path != null) {
sb.append(path).append(".");
sb.append(path).append('.');
}
sb.append(property.name());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ private String insertSql(String tableName) {
if (i > 0) {
sb.append(", ");
}
sb.append("?");
sb.append('?');
}
sb.append(")");
sb.append(')');
return sb.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public SpiSqlUpdate createInsert(SpiEbeanServer server) {
if (i > 0) {
sb.append(", ");
}
sb.append("?");
sb.append('?');
}
sb.append(")");
sb.append(')');
return new DefaultSqlUpdate(server, sb.toString(), bindParams);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ public void addJoin(String a1, String a2, StringBuilder sb) {
if (i > 0) {
sb.append(" and ");
}
sb.append(a1).append(".").append(pair.getLocalDbColumn());
sb.append(a1).append('.').append(pair.getLocalDbColumn());
sb.append(" = ");
sb.append(a2).append(".").append(pair.getForeignDbColumn());
sb.append(a2).append('.').append(pair.getForeignDbColumn());
}
}

Expand Down
Loading

0 comments on commit e09265f

Please sign in to comment.