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();
|
||||
if (valueAsString.startsWith(getContentStart())
|
||||
&& valueAsString.endsWith(getContentEnd())
|
||||
|| valueAsString.startsWith(getArrayStart())
|
||||
&& valueAsString.startsWith(getArrayEnd())) {
|
||||
if (isJsonObject(valueAsString) || isJsonArray(valueAsString)) {
|
||||
buffer.append(value);
|
||||
return;
|
||||
}
|
||||
|
@ -2594,6 +2591,16 @@ public abstract class ToStringStyle implements Serializable {
|
|||
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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue