下面列出了怎么用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);
}
@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();
}
/**
* 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();
}
/**
* 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();
}
/**
* 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();
}
@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("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("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();
}
@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();
}
/**
* 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();
}
@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();
}
@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() {
// @formatter:off
return new ToStringCreator(this)
.append("originRouteId", originRouteId)
.append("tags", getTags())
.toString();
// @formatter:on
}
@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
}
/**
* 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();
}
@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();
}