类 AssertionFailedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.mysql.cj.exceptions.CJException
-
- com.mysql.cj.exceptions.AssertionFailedException
-
- 所有已实现的接口:
Serializable
public class AssertionFailedException extends CJException
Assertions for empty code paths that should never be executed.- 另请参阅:
- 序列化表格
-
-
字段概要
-
从类继承的字段 com.mysql.cj.exceptions.CJException
exceptionMessage
-
-
构造器概要
构造器 构造器 说明 AssertionFailedException(Exception ex)Creates an AssertionFailedException for the given exception that should never have been thrown.AssertionFailedException(String assertion)Creates an AssertionFailedException for the reason given.
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static AssertionFailedExceptionshouldNotHappen(Exception ex)Convenience method.static AssertionFailedExceptionshouldNotHappen(String assertion)Create (and caller should subsequently throw) anAssertionFailedException.-
从类继承的方法 com.mysql.cj.exceptions.CJException
appendMessage, getMessage, getSQLState, getVendorCode, isTransient, setSQLState, setTransient, setVendorCode
-
-
-
-
构造器详细资料
-
AssertionFailedException
public AssertionFailedException(Exception ex)
Creates an AssertionFailedException for the given exception that should never have been thrown.- 参数:
ex- the exception that should never have been thrown.
-
AssertionFailedException
public AssertionFailedException(String assertion)
Creates an AssertionFailedException for the reason given.- 参数:
assertion- a description of the assertion that failed
-
-
方法详细资料
-
shouldNotHappen
public static AssertionFailedException shouldNotHappen(Exception ex) throws AssertionFailedException
Convenience method.- 参数:
ex- the exception that should never have been thrown.- 返回:
AssertionFailedException- 抛出:
AssertionFailedException- for the exception ex.
-
shouldNotHappen
public static AssertionFailedException shouldNotHappen(String assertion) throws AssertionFailedException
Create (and caller should subsequently throw) anAssertionFailedException.Typical use is as follows:
if (something == null) { throw AssertionFailedException.shouldNotHappen("Something cannot be null"); }- 参数:
assertion- message- 返回:
- the exception. exception should be thrown by the caller to satisfy compiler checks for data-flow, etc
- 抛出:
AssertionFailedException- if exception occurs
-
-