public class Lang extends Object
| Constructor and Description |
|---|
Lang() |
| Modifier and Type | Method and Description |
|---|---|
static RuntimeException |
impossible()
生成一个不可能的运行时异常
|
static boolean |
isCauseBy(Throwable e,
Class<? extends Throwable> causeType) |
static RuntimeException |
makeThrow(String format,
Object... args)
根据格式化字符串,生成运行时异常
|
static RuntimeException |
noImplement()
生成一个未实现的运行时异常
|
static Throwable |
unwrapThrow(Throwable e) |
static RuntimeException |
wrapThrow(Throwable e)
用运行时异常包裹抛出对象,如果抛出对象本身就是运行时异常,则直接返回。
|
static RuntimeException |
wrapThrow(Throwable e,
String fmt,
Object... args)
将抛出对象包裹成运行时异常,并增加自己的描述
|
public static RuntimeException noImplement()
public static RuntimeException impossible()
public static RuntimeException makeThrow(String format, Object... args)
format - 格式args - 参数public static RuntimeException wrapThrow(Throwable e, String fmt, Object... args)
e - 抛出对象fmt - 格式args - 参数public static RuntimeException wrapThrow(Throwable e)
如果是 InvocationTargetException,那么将其剥离,只包裹其 TargetException
e - 抛出对象Copyright © 2020. All rights reserved.