类org.springframework.core.style.ToStringCreator源码实例Demo

下面列出了怎么用org.springframework.core.style.ToStringCreator的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * 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);
}
 
/**
 * 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();
}
 
/**
 * 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);
}
 
/**
 * 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();
}
 
@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

}
 
/**
 * 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);
}
 
源代码7 项目: enhanced-pet-clinic   文件: Owner.java
@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();
}
 
源代码8 项目: spring-analysis-note   文件: MergedSqlConfig.java
/**
 * 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();
}
 
/**
 * 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();
}
 
@Override
public String toString() {
	ToStringCreator to = new ToStringCreator(this);
	to.append("name", this.name);
	to.append("configuration", this.configuration);
	return to.toString();
}
 
源代码11 项目: spring-analysis-note   文件: DefaultContextCache.java
/**
 * 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();
}
 
/**
 * 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();
}
 
源代码13 项目: spring-analysis-note   文件: MetaAnnotationUtils.java
/**
 * 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();
}
 
源代码14 项目: spring-analysis-note   文件: PersonEntity.java
@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
}
 
源代码15 项目: spring-graalvm-native   文件: Owner.java
@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();
}
 
源代码16 项目: spring-graalvm-native   文件: Owner.java
@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();
}
 
@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();
}
 
源代码18 项目: spring-cloud-gateway   文件: AbstractRateLimiter.java
@Override
public String toString() {
	return new ToStringCreator(this)
			.append("configurationPropertyName", configurationPropertyName)
			.append("config", getConfig()).append("configClass", getConfigClass())
			.toString();
}
 
/**
 * 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();
}
 
/**
 * 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 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();
}
 
源代码22 项目: java-technology-stack   文件: DefaultTestContext.java
/**
 * 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();
}
 
/**
 * 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();
}
 
源代码24 项目: spring-cloud-consul   文件: RetryProperties.java
@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();
}
 
/**
 * 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();
}
 
源代码26 项目: java-technology-stack   文件: PersonEntity.java
@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
}
 
源代码27 项目: spring-cloud-rsocket   文件: Forwarding.java
@Override
public String toString() {
	// @formatter:off
	return new ToStringCreator(this)
			.append("originRouteId", originRouteId)
			.append("tags", getTags())
			.toString();
	// @formatter:on
}
 
源代码28 项目: spring-cloud-rsocket   文件: Broker.java
@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
}
 
源代码29 项目: spring4-understanding   文件: DefaultTestContext.java
/**
 * 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();
}
 
源代码30 项目: audit4j-demo   文件: Owner.java
@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();
}
 
 类所在包
 类方法
 同包方法