org.apache.commons.lang3.ClassUtils#getShortClassName ( )源码实例Demo

下面列出了org.apache.commons.lang3.ClassUtils#getShortClassName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: vjtools   文件: ExceptionUtil.java
/**
 * 拼装 短异常类名: 异常信息 <-- 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 项目: j360-dubbo-app-all   文件: ExceptionUtil.java
/**
 * 拼装 短异常类名: 异常信息 <-- 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();
}
 
源代码3 项目: kafka-message-tool   文件: ThrowableUtils.java
public static String getMessage(Throwable e) {

        String msg = getRootCauseMessage(e);
        if (StringUtils.isBlank(msg)) {
            msg = ClassUtils.getShortClassName(e.getClass());
        }
        return msg;
    }
 
@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();
  }
}
 
源代码5 项目: poi-tl   文件: ReflectionUtils.java
public static Object getValue(String fieldName, Object obj) {
    Objects.requireNonNull(obj, "Class must not be null");
    Objects.requireNonNull(fieldName, "Name must not be null");
    Field field = findField(obj.getClass(), fieldName);
    if (null == field) {
        throw new ReflectionException(
                "No Such field " + fieldName + " from class" + ClassUtils.getShortClassName(obj.getClass()));
    }
    try {
        field.setAccessible(true);
        return field.get(obj);
    } catch (Exception e) {
        throw new ReflectionException(fieldName, obj.getClass(), e);
    }
}
 
源代码6 项目: poi-tl   文件: ReflectionException.java
public ReflectionException(String name, Class<?> clazz, Exception e) {
    this("Error Reflect " + name + "from class " + ClassUtils.getShortClassName(clazz), e);
}
 
源代码7 项目: astor   文件: ExceptionUtils.java
/**
 * 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);
}
 
源代码8 项目: astor   文件: ExceptionUtils.java
/**
 * 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(Throwable th) {
    if (th == null) {
        return "";
    }
    String clsName = ClassUtils.getShortClassName(th, null);
    String msg = th.getMessage();
    return clsName + ": " + StringUtils.defaultString(msg);
}
 
源代码9 项目: astor   文件: ExceptionUtils.java
/**
 * 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(Throwable th) {
    if (th == null) {
        return "";
    }
    String clsName = ClassUtils.getShortClassName(th, null);
    String msg = th.getMessage();
    return clsName + ": " + StringUtils.defaultString(msg);
}
 
源代码10 项目: astor   文件: ExceptionUtils.java
/**
 * 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(Throwable th) {
    if (th == null) {
        return "";
    }
    String clsName = ClassUtils.getShortClassName(th, null);
    String msg = th.getMessage();
    return clsName + ": " + StringUtils.defaultString(msg);
}
 
源代码11 项目: astor   文件: ExceptionUtils.java
/**
 * 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(Throwable th) {
    if (th == null) {
        return "";
    }
    String clsName = ClassUtils.getShortClassName(th, null);
    String msg = th.getMessage();
    return clsName + ": " + StringUtils.defaultString(msg);
}
 
源代码12 项目: vjtools   文件: ClassUtil.java
/**
 * 返回短Class名, 不包含PackageName.
 * 
 * 内部类的话,返回"主类.内部类"
 */
public static String getShortClassName(final Class<?> cls) {
	return ClassUtils.getShortClassName(cls);
}
 
源代码13 项目: vjtools   文件: ClassUtil.java
/**
 * 返回Class名,不包含PackageName
 * 
 * 内部类的话,返回"主类.内部类"
 */
public static String getShortClassName(final String className) {
	return ClassUtils.getShortClassName(className);
}
 
源代码14 项目: astor   文件: ToStringStyle.java
/**
 * <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);
}
 
源代码15 项目: j360-dubbo-app-all   文件: ClassUtil.java
/**
 * 返回Class名, 不包含PackageName.
 * 
 * 内部类的话,返回"主类.内部类"
 */
public static String getShortClassName(final Class<?> cls) {
	return ClassUtils.getShortClassName(cls);
}
 
源代码16 项目: j360-dubbo-app-all   文件: ClassUtil.java
/**
 * 返回Class名,不包含PackageName
 * 
 * 内部类的话,返回"主类.内部类"
 */
public static String getShortClassName(final String className) {
	return ClassUtils.getShortClassName(className);
}
 
源代码17 项目: coming   文件: Lang_34_ToStringStyle_s.java
/**
 * <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(Class<?> cls) {
    return ClassUtils.getShortClassName(cls);
}
 
源代码18 项目: coming   文件: Lang_34_ToStringStyle_t.java
/**
 * <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(Class<?> cls) {
    return ClassUtils.getShortClassName(cls);
}
 
源代码19 项目: astor   文件: ToStringStyle.java
/**
 * <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(Class<?> cls) {
    return ClassUtils.getShortClassName(cls);
}
 
源代码20 项目: astor   文件: ToStringStyle.java
/**
 * <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(Class<?> cls) {
    return ClassUtils.getShortClassName(cls);
}