io.github.cshencode.exception.StackTraceSingleException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shen-tool Show documentation
Show all versions of shen-tool Show documentation
工具类-简化steam操作
通过简单的方式完成流 分组、循环
package io.github.cshencode.exception;
/**
*
* - 没有错误栈的 单例异常
*
*
* @author css
* @since 2022/3/20
*/
public class StackTraceSingleException extends RuntimeCustomException {
/**
* 维护msg信息
*/
public final ThreadLocal msgThreadLocal = new ThreadLocal<>();
private final static StackTraceSingleException INSTANCE = new StackTraceSingleException();
private StackTraceSingleException() {
super(null, null, true, false);
}
public static StackTraceSingleException msg(String msg) {
INSTANCE.msgThreadLocal.set(msg);
return INSTANCE;
}
@Override
public String getMessage() {
return msgThreadLocal.get();
}
}