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) {
if (value == null) {
appendNullText(buffer, fieldName);
return;
}
if (value instanceof String || value instanceof Character) {
appendValueAsString(buffer, value.toString());
return;
}
if (value instanceof Number || value instanceof Boolean) {
buffer.append(value);
return;
}
final String valueAsString = value.toString();
if (valueAsString.startsWith(getContentStart()) && valueAsString.endsWith(getContentEnd())
|| valueAsString.startsWith(getArrayStart()) && valueAsString.startsWith(getArrayEnd())
) {
if (valueAsString.startsWith(getContentStart())
&& valueAsString.endsWith(getContentEnd())
|| valueAsString.startsWith(getArrayStart())
&& valueAsString.startsWith(getArrayEnd())) {
buffer.append(value);
return;
}

View File

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