本文整理匯總了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);
}