/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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)); }
/** * 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 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)); }
/** * 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)); }
/** * 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(); }
/** * 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(); } }
/** * Provide a String representation of the {@code @TestPropertySource} * attributes and declaring class. */ @Override public String toString() { return new ToStringCreator(this)// .append("declaringClass", this.declaringClass.getName())// .append("locations", ObjectUtils.nullSafeToString(this.locations))// .append("inheritLocations", this.inheritLocations)// .append("properties", ObjectUtils.nullSafeToString(this.properties))// .append("inheritProperties", this.inheritProperties)// .toString(); }
/** * Provide a String representation of the context configuration attributes * and declaring class. */ @Override public String toString() { return new ToStringCreator(this) .append("declaringClass", this.declaringClass.getName()) .append("classes", ObjectUtils.nullSafeToString(this.classes)) .append("locations", ObjectUtils.nullSafeToString(this.locations)) .append("inheritLocations", this.inheritLocations) .append("initializers", ObjectUtils.nullSafeToString(this.initializers)) .append("inheritInitializers", this.inheritInitializers) .append("name", this.name) .append("contextLoaderClass", this.contextLoaderClass.getName()) .toString(); }
/** * Provide a String representation of this bootstrap context's state. */ @Override public String toString() { return new ToStringCreator(this)// .append("testClass", this.testClass.getName())// .append("cacheAwareContextLoaderDelegate", this.cacheAwareContextLoaderDelegate.getClass().getName())// .toString(); }
/** * Generate a text string containing the implementation type of this * cache and its statistics. * <p>The string returned by this method contains all information * required for compliance with the contract for {@link #logStatistics()}. * @return a string representation of this cache, including statistics */ @Override public String toString() { return new ToStringCreator(this) .append("size", size()) .append("maxSize", getMaxSize()) .append("parentContextCount", getParentContextCount()) .append("hitCount", getHitCount()) .append("missCount", getMissCount()) .toString(); }
@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 }
@Override public String toString() { return new ToStringCreator(this)// .append("collaborator", this.collaborator)// .toString(); }
@Override public String toString() { return new ToStringCreator(this).append("familyFavoriteSport", map).toString(); } };
@Test public void appendList() { List<SomeObject> list = new ArrayList<>(); list.add(s1); list.add(s2); list.add(s3); String str = new ToStringCreator(this).append("myLetters", list).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myLetters = list[A, B, C]]", str); }
@Test public void appendSet() { Set<SomeObject> set = new LinkedHashSet<>(); set.add(s1); set.add(s2); set.add(s3); String str = new ToStringCreator(this).append("myLetters", set).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myLetters = set[A, B, C]]", str); }
@Test public void appendMethod() throws Exception { String str = new ToStringCreator(this).append("myMethod", this.getClass().getMethod("appendMethod")).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myMethod = appendMethod@ToStringCreatorTests]", str); }
@Test public void appendClass() { String str = new ToStringCreator(this).append("myClass", this.getClass()).toString(); assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) + " myClass = ToStringCreatorTests]", str); }