Simplify DefaultBootstrapContext.toString()

This commit is contained in:
Sam Brannen 2014-04-10 00:44:14 +02:00
parent b308659cda
commit e1a1e1205f
1 changed files with 2 additions and 12 deletions

View File

@ -60,19 +60,9 @@ class DefaultBootstrapContext implements BootstrapContext {
@Override
public String toString() {
return new ToStringCreator(this)//
.append("testClass", testClass)//
.append("cacheAwareContextLoaderDelegate", nullSafeToString(cacheAwareContextLoaderDelegate))//
.append("testClass", testClass.getName())//
.append("cacheAwareContextLoaderDelegate", cacheAwareContextLoaderDelegate.getClass().getName())//
.toString();
}
/**
* Generate a null-safe {@link String} representation of the supplied
* {@link CacheAwareContextLoaderDelegate} based solely on the fully qualified
* name of the delegate or "null" if the supplied delegate is
* {@code null}.
*/
private static String nullSafeToString(CacheAwareContextLoaderDelegate delegate) {
return delegate == null ? "null" : delegate.getClass().getName();
}
}