/** * Append the provided value. * @param value the value to append * @return this, to support call-chaining. */ public ToStringCreator append(Object value) { this.styler.styleValue(this.buffer, value); return this; }
/** * Style the specified value according to default conventions. * @param value the Object value to style * @return the styled String * @see DefaultValueStyler */ public static String style(Object value) { return DEFAULT_VALUE_STYLER.style(value); }
private void printFieldSeparatorIfNecessary() { if (this.styledFirstField) { this.styler.styleFieldSeparator(this.buffer); } else { this.styledFirstField = true; } }
/** * Provide a textual representation of this {@code AnnotationDescriptor}. */ @Override public String toString() { return new ToStringCreator(this) .append("rootDeclaringClass", this.rootDeclaringClass) .append("declaringClass", this.declaringClass) .append("composedAnnotation", this.composedAnnotation) .append("annotation", this.annotation) .toString(); } }
/** * Append a byte field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, byte value) { return append(fieldName, Byte.valueOf(value)); }
@Override public void styleField(StringBuilder buffer, String fieldName, @Nullable Object value) { styleFieldStart(buffer, fieldName); styleValue(buffer, value); styleFieldEnd(buffer, fieldName); }
/** * Append a field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, @Nullable Object value) { printFieldSeparatorIfNecessary(); this.styler.styleField(this.buffer, fieldName, value); return this; }
/** * Create a ToStringCreator for the given object, using the provided style. * @param obj the object to be stringified * @param styler the ValueStyler encapsulating pretty-print instructions */ public ToStringCreator(Object obj, @Nullable ValueStyler styler) { this(obj, new DefaultToStringStyler(styler != null ? styler : StylerUtils.DEFAULT_VALUE_STYLER)); }
/** * Return the String representation that this ToStringCreator built. */ @Override public String toString() { this.styler.styleEnd(this.buffer, this.object); return this.buffer.toString(); }
/** * Provide a String representation of this test context's state. */ @Override public String toString() { return new ToStringCreator(this) .append("testClass", this.testClass) .append("testInstance", this.testInstance) .append("testMethod", this.testMethod) .append("testException", this.testException) .append("mergedContextConfiguration", this.mergedContextConfiguration) .append("attributes", this.attributes) .toString(); }
/** * Append a short field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, short value) { return append(fieldName, Short.valueOf(value)); }
/** * Provide a String representation of the merged SQL script configuration. */ @Override public String toString() { return new ToStringCreator(this) .append("dataSource", this.dataSource) .append("transactionManager", this.transactionManager) .append("transactionMode", this.transactionMode) .append("encoding", this.encoding) .append("separator", this.separator) .append("commentPrefix", this.commentPrefix) .append("blockCommentStartDelimiter", this.blockCommentStartDelimiter) .append("blockCommentEndDelimiter", this.blockCommentEndDelimiter) .append("errorMode", this.errorMode) .toString(); }
/** * Append a long field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, long value) { return append(fieldName, Long.valueOf(value)); }
@Override public String toString() { return new ToStringCreator(this)// .append("collaborator", this.collaborator)// .toString(); }
/** * Append a double field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, double value) { return append(fieldName, Double.valueOf(value)); }
@Override public String toString() { return new ToStringCreator(this).append("familyFavoriteSport", map).toString(); } };
/** * Append a integer field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, int value) { return append(fieldName, Integer.valueOf(value)); }
@Override public String toString() { // @formatter:off return new ToStringCreator(this) .append("id", this.getId()) .append("name", this.name) .append("age", this.age) .append("eyeColor", this.eyeColor) .append("likesPets", this.likesPets) .append("favoriteNumber", this.favoriteNumber) .toString(); // @formatter:on }
/** * Append a boolean field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, boolean value) { return append(fieldName, Boolean.valueOf(value)); }
/** * Append a float field value. * @param fieldName the name of the field, usually the member variable name * @param value the field value * @return this, to support call-chaining */ public ToStringCreator append(String fieldName, float value) { return append(fieldName, Float.valueOf(value)); }