本文整理了Java中org.springframework.core.style.ToStringCreator.
方法的一些代码示例,展示了ToStringCreator.
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ToStringCreator.
方法的具体详情如下:
包路径:org.springframework.core.style.ToStringCreator
类名称:ToStringCreator
方法名:
[英]Create a ToStringCreator for the given object.
[中]为给定对象创建ToString Creator。
代码示例来源:origin: spring-projects/spring-framework
/**
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public String toString() {
return new ToStringCreator(this)//
.append("collaborator", this.collaborator)//
.toString();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public String toString() {
return new ToStringCreator(this).append("familyFavoriteSport", map).toString();
}
};
代码示例来源:origin: spring-projects/spring-framework
/**
* 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();
}
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void appendList() {
List
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);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void appendSet() {
Set
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);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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
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);
}
代码示例来源:origin: spring-projects/spring-framework
@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);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void appendClass() {
String str = new ToStringCreator(this).append("myClass", this.getClass()).toString();
assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) +
" myClass = ToStringCreatorTests]", str);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void primitiveArrays() {
int[] integers = new int[] {0, 1, 2, 3, 4};
String str = new ToStringCreator(integers).toString();
assertEquals("[@" + ObjectUtils.getIdentityHexString(integers) + " array
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void defaultStyleArray() {
SomeObject[] array = new SomeObject[] {s1, s2, s3};
String str = new ToStringCreator(array).toString();
assertEquals("[@" + ObjectUtils.getIdentityHexString(array) +
" array
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
The string returned by this method contains all information/**
* Generate a text string containing the implementation type of this
* cache and its statistics.
*
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
@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
}
代码示例来源:origin: spring-projects/spring-petclinic
@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();
}
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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();
}
代码示例来源:origin: spring-projects/spring-framework
/**
* 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},
* {@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("contextCustomizers", getContextCustomizers())
.append("resourceBasePath", getResourceBasePath())
.append("contextLoader", nullSafeClassName(getContextLoader()))
.append("parent", getParent())
.toString();
}