Extract logic for checking string representation of objects into separate methods
This commit is contained in:
parent
28656559d2
commit
e8db7237a9
|
@ -2583,10 +2583,7 @@ public abstract class ToStringStyle implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
final String valueAsString = value.toString();
|
final String valueAsString = value.toString();
|
||||||
if (valueAsString.startsWith(getContentStart())
|
if (isJsonObject(valueAsString) || isJsonArray(valueAsString)) {
|
||||||
&& valueAsString.endsWith(getContentEnd())
|
|
||||||
|| valueAsString.startsWith(getArrayStart())
|
|
||||||
&& valueAsString.startsWith(getArrayEnd())) {
|
|
||||||
buffer.append(value);
|
buffer.append(value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2594,6 +2591,16 @@ public abstract class ToStringStyle implements Serializable {
|
||||||
appendDetail(buffer, fieldName, valueAsString);
|
appendDetail(buffer, fieldName, valueAsString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isJsonArray(String valueAsString) {
|
||||||
|
return valueAsString.startsWith(getArrayStart())
|
||||||
|
&& valueAsString.startsWith(getArrayEnd());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isJsonObject(String valueAsString) {
|
||||||
|
return valueAsString.startsWith(getContentStart())
|
||||||
|
&& valueAsString.endsWith(getContentEnd());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Appends the given String in parenthesis to the given StringBuffer.
|
* Appends the given String in parenthesis to the given StringBuffer.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue