/** * Returns a StringBuilder instance with the {@link #getName() name}, or if the name is {@code null}, just the * {@code super.toStringBuilder()} instance. * * @return a StringBuilder instance to use for appending String data that will eventually be returned from a * {@code toString()} invocation. */ protected StringBuilder toStringBuilder() { String name = getName(); if (name == null) { return super.toStringBuilder(); } else { StringBuilder sb = new StringBuilder(); sb.append(name); return sb; } }