| 构造器和说明 |
|---|
AssertResult() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> Assert.AssertResult<T> |
build(T t,
boolean isTrue) |
boolean |
isTrue() |
Assert.AssertResult<T> |
isTrue(Consumer<T> consumer)
为true时执行处理函数
|
T |
or(Supplier<T> supplier)
为true时返回断言对象,否则调用处理函数并返回函数结果
|
T |
or(T t)
为true时返回断言对象,否则返回目标对象
|
T |
orThrow(Function<String,RuntimeException> function,
String message)
为true时返回断言对象,否则调用处理函数并抛出函数返回的异常
该方法接收额外一个异常信息参数message,会被作为参数传到处理函数中
建议用法:AssertResult.orThrow(RuntimeException::new,"error message")
|
T |
orThrow(RuntimeException e)
为true时返回断言对象,否则抛出异常对象
|
T |
orThrow(Supplier<RuntimeException> supplier)
为true时返回断言对象,否则调用处理函数并抛出函数返回的异常
|
public static <T> Assert.AssertResult<T> build(T t, boolean isTrue)
public T orThrow(RuntimeException e) throws RuntimeException
e - 异常对象RuntimeException - 异常对象public T orThrow(Supplier<RuntimeException> supplier) throws RuntimeException
supplier - 处理函数RuntimeException - 函数返回的异常public T orThrow(Function<String,RuntimeException> function, String message) throws RuntimeException
function - 处理函数message - 异常信息RuntimeException - 函数返回的异常public boolean isTrue()
public Assert.AssertResult<T> isTrue(Consumer<T> consumer)
consumer - 处理函数Copyright © 2025 EFCloud. All rights reserved.