Java Code Examples for org.springframework.core.style.ToStringCreator

The following examples show how to use org.springframework.core.style.ToStringCreator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: PrintingResultHandler.java    License: MIT License 6 votes vote down vote up
/**
 * Print the supplied cookies in a human-readable form, assuming the
 * {@link Cookie} implementation does not provide its own {@code toString()}.
 * @since 4.2
 */
private void printCookies(Cookie[] cookies) {
	String[] cookieStrings = new String[cookies.length];
	for (int i = 0; i < cookies.length; i++) {
		Cookie cookie = cookies[i];
		cookieStrings[i] = new ToStringCreator(cookie)
			.append("name", cookie.getName())
			.append("value", cookie.getValue())
			.append("comment", cookie.getComment())
			.append("domain", cookie.getDomain())
			.append("maxAge", cookie.getMaxAge())
			.append("path", cookie.getPath())
			.append("secure", cookie.getSecure())
			.append("version", cookie.getVersion())
			.append("httpOnly", cookie.isHttpOnly())
			.toString();
	}
	this.printer.printValue("Cookies", cookieStrings);
}
 
Example 2
Source Project: spring-analysis-note   Source File: MergedContextConfiguration.java    License: MIT License 6 votes vote down vote up
/**
 * Provide a String representation of the {@linkplain #getTestClass() test class},
 * {@linkplain #getLocations() locations}, {@linkplain #getClasses() annotated classes},
 * {@linkplain #getContextInitializerClasses() context initializer classes},
 * {@linkplain #getActiveProfiles() active profiles},
 * {@linkplain #getPropertySourceLocations() property source locations},
 * {@linkplain #getPropertySourceProperties() property source properties},
 * {@linkplain #getContextCustomizers() context customizers},
 * the name of the {@link #getContextLoader() ContextLoader}, and the
 * {@linkplain #getParent() parent configuration}.
 */
@Override
public String toString() {
	return new ToStringCreator(this)
			.append("testClass", this.testClass)
			.append("locations", ObjectUtils.nullSafeToString(this.locations))
			.append("classes", ObjectUtils.nullSafeToString(this.classes))
			.append("contextInitializerClasses", ObjectUtils.nullSafeToString(this.contextInitializerClasses))
			.append("activeProfiles", ObjectUtils.nullSafeToString(this.activeProfiles))
			.append("propertySourceLocations", ObjectUtils.nullSafeToString(this.propertySourceLocations))
			.append("propertySourceProperties", ObjectUtils.nullSafeToString(this.propertySourceProperties))
			.append("contextCustomizers", this.contextCustomizers)
			.append("contextLoader", nullSafeClassName(this.contextLoader))
			.append("parent", this.parent)
			.toString();
}
 
Example 3
Source Project: java-technology-stack   Source File: PrintingResultHandler.java    License: MIT License 6 votes vote down vote up
/**
 * Print the supplied cookies in a human-readable form, assuming the
 * {@link Cookie} implementation does not provide its own {@code toString()}.
 * @since 4.2
 */
private void printCookies(Cookie[] cookies) {
	String[] cookieStrings = new String[cookies.length];
	for (int i = 0; i < cookies.length; i++) {
		Cookie cookie = cookies[i];
		cookieStrings[i] = new ToStringCreator(cookie)
			.append("name", cookie.getName())
			.append("value", cookie.getValue())
			.append("comment", cookie.getComment())
			.append("domain", cookie.getDomain())
			.append("maxAge", cookie.getMaxAge())
			.append("path", cookie.getPath())
			.append("secure", cookie.getSecure())
			.append("version", cookie.getVersion())
			.append("httpOnly", cookie.isHttpOnly())
			.toString();
	}
	this.printer.printValue("Cookies", cookieStrings);
}
 
Example 4
/**
 * Provide a String representation of the {@linkplain #getTestClass() test class},
 * {@linkplain #getLocations() locations}, {@linkplain #getClasses() annotated classes},
 * {@linkplain #getContextInitializerClasses() context initializer classes},
 * {@linkplain #getActiveProfiles() active profiles},
 * {@linkplain #getPropertySourceLocations() property source locations},
 * {@linkplain #getPropertySourceProperties() property source properties},
 * {@linkplain #getResourceBasePath() resource base path}, the name of the
 * {@link #getContextLoader() ContextLoader}, and the
 * {@linkplain #getParent() parent configuration}.
 */
@Override
public String toString() {
	return new ToStringCreator(this)
			.append("testClass", getTestClass())
			.append("locations", ObjectUtils.nullSafeToString(getLocations()))
			.append("classes", ObjectUtils.nullSafeToString(getClasses()))
			.append("contextInitializerClasses", ObjectUtils.nullSafeToString(getContextInitializerClasses()))
			.append("activeProfiles", ObjectUtils.nullSafeToString(getActiveProfiles()))
			.append("propertySourceLocations", ObjectUtils.nullSafeToString(getPropertySourceLocations()))
			.append("propertySourceProperties", ObjectUtils.nullSafeToString(getPropertySourceProperties()))
			.append("resourceBasePath", getResourceBasePath())
			.append("contextLoader", nullSafeToString(getContextLoader()))
			.append("parent", getParent())
			.toString();
}
 
Example 5
Source Project: spring-cloud-gateway   Source File: HttpClientProperties.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public String toString() {
	// @formatter:off
	return new ToStringCreator(this)
			.append("connectTimeout", connectTimeout)
			.append("responseTimeout", responseTimeout)
			.append("maxHeaderSize", maxHeaderSize)
			.append("maxInitialLineLength", maxInitialLineLength)
			.append("pool", pool)
			.append("proxy", proxy)
			.append("ssl", ssl)
			.append("websocket", websocket)
			.append("wiretap", wiretap)
			.toString();
	// @formatter:on

}
 
Example 6
/**
 * Print the supplied cookies in a human-readable form, assuming the
 * {@link Cookie} implementation does not provide its own {@code toString()}.
 * @since 4.2
 */
private void printCookies(Cookie[] cookies) {
	String[] cookieStrings = new String[cookies.length];
	for (int i = 0; i < cookies.length; i++) {
		Cookie cookie = cookies[i];
		cookieStrings[i] = new ToStringCreator(cookie)
			.append("name", cookie.getName())
			.append("value", cookie.getValue())
			.append("comment", cookie.getComment())
			.append("domain", cookie.getDomain())
			.append("maxAge", cookie.getMaxAge())
			.append("path", cookie.getPath())
			.append("secure", cookie.getSecure())
			.append("version", cookie.getVersion())
			.append("httpOnly", cookie.isHttpOnly())
			.toString();
	}
	this.printer.printValue("Cookies", cookieStrings);
}
 
Example 7
Source Project: enhanced-pet-clinic   Source File: Owner.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	return new ToStringCreator(this).append("id", this.getId()).append("new", this.isNew())
			.append("lastName", this.getLastName()).append("firstName", this.getFirstName())
			.append("address", this.address).append("city", this.city).append("telephone", this.telephone)
			.toString();
}
 
Example 8
Source Project: spring-analysis-note   Source File: MergedSqlConfig.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 9
Source Project: spring-analysis-note   Source File: DefaultBootstrapContext.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 10
@Override
public String toString() {
	ToStringCreator to = new ToStringCreator(this);
	to.append("name", this.name);
	to.append("configuration", this.configuration);
	return to.toString();
}
 
Example 11
Source Project: spring-analysis-note   Source File: DefaultContextCache.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 12
/**
 * 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();
}
 
Example 13
Source Project: spring-analysis-note   Source File: MetaAnnotationUtils.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 14
Source Project: spring-analysis-note   Source File: PersonEntity.java    License: MIT License 5 votes vote down vote up
@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
}
 
Example 15
Source Project: spring-graalvm-native   Source File: Owner.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    return new ToStringCreator(this)

            .append("id", this.getId()).append("new", this.isNew()).append("lastName", this.getLastName())
            .append("firstName", this.getFirstName()).append("address", this.address).append("city", this.city)
            .append("telephone", this.telephone).toString();
}
 
Example 16
Source Project: spring-graalvm-native   Source File: Owner.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	return new ToStringCreator(this)

			.append("id", this.getId()).append("new", this.isNew()).append("lastName", this.getLastName())
			.append("firstName", this.getFirstName()).append("address", this.address).append("city", this.city)
			.append("telephone", this.telephone).toString();
}
 
Example 17
@Override
public String toString() {
	return new ToStringCreator(this).append("enabled", this.enabled)
			.append("prefix", this.prefix)
			.append("defaultContext", this.defaultContext)
			.append("profileSeparator", this.profileSeparator)
			.append("format", this.format).append("dataKey", this.dataKey)
			.append("aclToken", this.aclToken).append("watch", this.watch)
			.append("failFast", this.failFast).append("name", this.name).toString();
}
 
Example 18
Source Project: spring-cloud-gateway   Source File: AbstractRateLimiter.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	return new ToStringCreator(this)
			.append("configurationPropertyName", configurationPropertyName)
			.append("config", getConfig()).append("configClass", getConfigClass())
			.toString();
}
 
Example 19
/**
 * Provide a String representation of this bootstrap context's state.
 */
@Override
public String toString() {
	return new ToStringCreator(this)//
	.append("testClass", testClass.getName())//
	.append("cacheAwareContextLoaderDelegate", cacheAwareContextLoaderDelegate.getClass().getName())//
	.toString();
}
 
Example 20
/**
 * 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();
}
 
Example 21
Source Project: java-technology-stack   Source File: DefaultBootstrapContext.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 22
Source Project: java-technology-stack   Source File: DefaultTestContext.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 23
Source Project: java-technology-stack   Source File: DefaultContextCache.java    License: MIT License 5 votes vote down vote up
/**
 * 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();
}
 
Example 24
Source Project: spring-cloud-consul   Source File: RetryProperties.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	return new ToStringCreator(this).append("enabled", this.enabled)
			.append("initialInterval", this.initialInterval)
			.append("multiplier", this.multiplier)
			.append("maxInterval", this.maxInterval)
			.append("maxAttempts", this.maxAttempts).toString();
}
 
Example 25
/**
 * 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();
}
 
Example 26
Source Project: java-technology-stack   Source File: PersonEntity.java    License: MIT License 5 votes vote down vote up
@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
}
 
Example 27
Source Project: spring-cloud-rsocket   Source File: Forwarding.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	// @formatter:off
	return new ToStringCreator(this)
			.append("originRouteId", originRouteId)
			.append("tags", getTags())
			.toString();
	// @formatter:on
}
 
Example 28
Source Project: spring-cloud-rsocket   Source File: Broker.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
	// @formatter:off
	return new ToStringCreator(this)
			.append("host", host)
			.append("port", port)
			.append("wsUri", wsUri)
			.append("connectionType", connectionType)
			.toString();
	// @formatter:on
}
 
Example 29
Source Project: spring4-understanding   Source File: DefaultTestContext.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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)
			.toString();
}
 
Example 30
Source Project: audit4j-demo   Source File: Owner.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public String toString() {
    return new ToStringCreator(this)

            .append("id", this.getId())
            .append("new", this.isNew())
            .append("lastName", this.getLastName())
            .append("firstName", this.getFirstName())
            .append("address", this.address)
            .append("city", this.city)
            .append("telephone", this.telephone)
            .toString();
}