本文整理匯總了Java中org.apache.commons.lang3.ClassUtils.getShortClassName方法的典型用法代碼示例。如果您正苦於以下問題:Java ClassUtils.getShortClassName方法的具體用法?Java ClassUtils.getShortClassName怎麽用?Java ClassUtils.getShortClassName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.lang3.ClassUtils
的用法示例。
在下文中一共展示了ClassUtils.getShortClassName方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toStringWithRootCause
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
* 拚裝 短異常類名: 異常信息 <-- RootCause的短異常類名: 異常信息
*/
public static String toStringWithRootCause(@Nullable Throwable t) {
if (t == null) {
return StringUtils.EMPTY;
}
final String clsName = ClassUtils.getShortClassName(t, null);
final String message = StringUtils.defaultString(t.getMessage());
Throwable cause = getRootCause(t);
StringBuilder sb = new StringBuilder(128).append(clsName).append(": ").append(message);
if (cause != t) {
sb.append("; <---").append(toStringWithShortName(cause));
}
return sb.toString();
}
示例2: activate
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
@Override
public final void activate(OperatorContext ctx)
{
isActive = true;
if (this instanceof Runnable) {
ioThread = new Thread((Runnable)this, "io-" + ClassUtils.getShortClassName(this.getClass()));
ioThread.start();
}
}
示例3: getMessage
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
* Gets a short message summarising the exception.
* <p>
* The message returned is of the form
* {ClassNameWithoutPackage}: {ThrowableMessage}
*
* @param th the throwable to get a message for, null returns empty string
* @return the message, non-null
* @since Commons Lang 2.2
*/
public static String getMessage(final Throwable th) {
if (th == null) {
return "";
}
final String clsName = ClassUtils.getShortClassName(th, null);
final String msg = th.getMessage();
return clsName + ": " + StringUtils.defaultString(msg);
}
示例4: getMessage
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
* Gets a short message summarising the exception.
* <p>
* The message returned is of the form
* {ClassNameWithoutPackage}: {ThrowableMessage}
*
* @param th the throwable to get a message for, null returns empty string
* @return the message, non-null
* @since Commons Lang 2.2
*/
public static String getMessage(final Throwable th) {
if (th == null) {
return "";
}
final String clsName = ClassUtils.getShortClassName(th, null);
final String msg = th.getMessage();
return clsName + ": " + StringUtils.defaultString(msg);
}
示例5: getReturnType
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
* <p>
* getReturnType
* </p>
*
* @param clazz
* a {@link java.lang.Class} object.
* @return a {@link java.lang.String} object.
*/
public static String getReturnType(Class<?> clazz) {
String retVal = ClassUtils.getShortClassName(clazz);
if (primitiveClasses.contains(retVal))
return clazz.getSimpleName();
return retVal;
}
示例6: getShortClassName
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
* 返回Class名, 不包含PackageName.
*
* 內部類的話,返回"主類.內部類"
*/
public static String getShortClassName(final Class<?> cls) {
return ClassUtils.getShortClassName(cls);
}
示例7: getShortClassName
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
* <p>Gets the short class name for a class.</p>
* <p>
* <p>The short class name is the classname excluding
* the package name.</p>
*
* @param cls the <code>Class</code> to get the short name of
* @return the short name
*/
protected String getShortClassName(final Class<?> cls) {
return ClassUtils.getShortClassName(cls);
}
示例8: getShortClassName
import org.apache.commons.lang3.ClassUtils; //導入方法依賴的package包/類
/**
* <p>Gets the short class name for a class.</p>
*
* <p>The short class name is the classname excluding
* the package name.</p>
*
* @param cls the <code>Class</code> to get the short name of
* @return the short name
*/
protected String getShortClassName(final Class<?> cls) {
return ClassUtils.getShortClassName(cls);
}