本文整理汇总了Java中org.springframework.util.ObjectUtils.nullSafeToString方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectUtils.nullSafeToString方法的具体用法?Java ObjectUtils.nullSafeToString怎么用?Java ObjectUtils.nullSafeToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.ObjectUtils
的用法示例。
在下文中一共展示了ObjectUtils.nullSafeToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (ReflectionUtils.isEqualsMethod(method)) {
// Only consider equal when proxies are identical.
return (proxy == args[0]);
}
else if (ReflectionUtils.isHashCodeMethod(method)) {
// Use hashCode of reference proxy.
return System.identityHashCode(proxy);
}
else if (!initialized && ReflectionUtils.isToStringMethod(method)) {
return "Early singleton proxy for interfaces " +
ObjectUtils.nullSafeToString(getEarlySingletonInterfaces());
}
try {
return method.invoke(getSingletonInstance(), args);
}
catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
}
示例2: obtainDefaultPersistenceUnitInfo
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
@Override
public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo() {
if (this.persistenceUnitInfoNames.isEmpty()) {
throw new IllegalStateException("No persistence units parsed from " +
ObjectUtils.nullSafeToString(this.persistenceXmlLocations));
}
if (this.persistenceUnitInfos.isEmpty()) {
throw new IllegalStateException("All persistence units from " +
ObjectUtils.nullSafeToString(this.persistenceXmlLocations) + " already obtained");
}
if (this.persistenceUnitInfos.size() > 1) {
return obtainPersistenceUnitInfo(this.defaultPersistenceUnitName);
}
PersistenceUnitInfo pui = this.persistenceUnitInfos.values().iterator().next();
this.persistenceUnitInfos.clear();
return pui;
}
示例3: arrayToDelimitedString
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
/**
* Convenience method to return a String array as a delimited (e.g. CSV)
* String. E.g. useful for {@code toString()} implementations.
* @param arr the array to display
* @param delim the delimiter to use (probably a ",")
* @return the delimited String
*/
public static String arrayToDelimitedString(Object[] arr, String delim) {
if (ObjectUtils.isEmpty(arr)) {
return "";
}
if (arr.length == 1) {
return ObjectUtils.nullSafeToString(arr[0]);
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
if (i > 0) {
sb.append(delim);
}
sb.append(arr[i]);
}
return sb.toString();
}
示例4: raiseNoSuchBeanDefinitionException
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
/**
* Raise a NoSuchBeanDefinitionException for an unresolvable dependency.
*/
private void raiseNoSuchBeanDefinitionException(
Class<?> type, String dependencyDescription, DependencyDescriptor descriptor)
throws NoSuchBeanDefinitionException {
throw new NoSuchBeanDefinitionException(type, dependencyDescription,
"expected at least 1 bean which qualifies as autowire candidate for this dependency. " +
"Dependency annotations: " + ObjectUtils.nullSafeToString(descriptor.getAnnotations()));
}
示例5: find
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
public Object find(RequestContext requestContext) {
val key = ObjectUtils.nullSafeToString(keyExpression.evaluate(requestContext));
return values.get(key);
}
示例6: toString
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
@Override
public String toString() {
return getClass().getName() + ": advice [" + getAdvice() +
"], pointcut patterns " + ObjectUtils.nullSafeToString(this.patterns);
}
示例7: toString
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
@Override
public String toString() {
return getClass().getName() + ": patterns " + ObjectUtils.nullSafeToString(this.patterns) +
", excluded patterns " + ObjectUtils.nullSafeToString(this.excludedPatterns);
}
示例8: contextKeyString
import org.springframework.util.ObjectUtils; //导入方法依赖的package包/类
/**
* Subclasses can override this to return a String representation of their
* context key for use in caching and logging.
* @param contextKey the context key
*/
protected String contextKeyString(Object contextKey) {
return ObjectUtils.nullSafeToString(contextKey);
}