Format source code

This commit is contained in:
Benedikt Ritter 2015-05-01 23:51:03 +02:00
parent 07ec8ad2dd
commit 28656559d2
2 changed files with 17 additions and 22 deletions

View File

@ -2568,28 +2568,25 @@ public abstract class ToStringStyle implements Serializable {
protected void appendDetail(StringBuffer buffer, String fieldName, Object value) { protected void appendDetail(StringBuffer buffer, String fieldName, Object value) {
if (value == null) { if (value == null) {
appendNullText(buffer, fieldName); appendNullText(buffer, fieldName);
return; return;
} }
if (value instanceof String || value instanceof Character) { if (value instanceof String || value instanceof Character) {
appendValueAsString(buffer, value.toString()); appendValueAsString(buffer, value.toString());
return; return;
} }
if (value instanceof Number || value instanceof Boolean) { if (value instanceof Number || value instanceof Boolean) {
buffer.append(value); buffer.append(value);
return; return;
} }
final String valueAsString = value.toString(); final String valueAsString = value.toString();
if (valueAsString.startsWith(getContentStart()) && valueAsString.endsWith(getContentEnd()) if (valueAsString.startsWith(getContentStart())
|| valueAsString.startsWith(getArrayStart()) && valueAsString.startsWith(getArrayEnd()) && valueAsString.endsWith(getContentEnd())
) { || valueAsString.startsWith(getArrayStart())
&& valueAsString.startsWith(getArrayEnd())) {
buffer.append(value); buffer.append(value);
return; return;
} }

View File

@ -94,7 +94,6 @@ public class JsonToStringStyleTest {
@Test @Test
public void testChar() { public void testChar() {
try { try {
new ToStringBuilder(base).append('A').toString(); new ToStringBuilder(base).append('A').toString();
fail("Should have generated UnsupportedOperationException"); fail("Should have generated UnsupportedOperationException");
@ -109,7 +108,6 @@ public class JsonToStringStyleTest {
@Test @Test
public void testDate() { public void testDate() {
final Date now = new Date(); final Date now = new Date();
final Date afterNow = new Date(System.currentTimeMillis() + 1); final Date afterNow = new Date(System.currentTimeMillis() + 1);