Package top.mrxiaom.overflow.action
Class ActionContext
-
- All Implemented Interfaces:
@Serializable() public final class ActionContextOnebot 主动操作上下文
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classActionContext.Builderpublic classActionContext.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Stringactionprivate BooleanthrowExceptionsprivate BooleanignoreStatuspublic final static ActionContext.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description ActionContext(String action, Boolean throwExceptions, Boolean ignoreStatus)
-
Method Summary
Modifier and Type Method Description final StringgetAction()final BooleangetThrowExceptions()是否在调用失败时抛出异常。 如果为
false(默认),则使用 warn 级别打印一条日志如果为
true,则抛出异常如果为
null,则使用 trace 级别打印日志,不抛出异常
final UnitsetThrowExceptions(Boolean throwExceptions)是否在调用失败时抛出异常。 如果为
false(默认),则使用 warn 级别打印一条日志如果为
true,则抛出异常如果为
null,则使用 trace 级别打印日志,不抛出异常
final BooleangetIgnoreStatus()是否将返回结果没有 "status"的情况,当作调用成功。若开启此选项,明确出现网络问题或者明确指定"status": "failed"才会当作调用失败。final UnitsetIgnoreStatus(Boolean ignoreStatus)是否将返回结果没有 "status"的情况,当作调用成功。若开启此选项,明确出现网络问题或者明确指定"status": "failed"才会当作调用失败。final static ActionContext.Builderbuilder(String action)final static ActionContext.Builderbuilder(String action, Consumer<ActionContext.Builder> block)final static ActionContextbuild(String action, Consumer<ActionContext.Builder> block)-
-
Method Detail
-
getThrowExceptions
final Boolean getThrowExceptions()
是否在调用失败时抛出异常。
如果为
false(默认),则使用 warn 级别打印一条日志如果为
true,则抛出异常如果为
null,则使用 trace 级别打印日志,不抛出异常
-
setThrowExceptions
final Unit setThrowExceptions(Boolean throwExceptions)
是否在调用失败时抛出异常。
如果为
false(默认),则使用 warn 级别打印一条日志如果为
true,则抛出异常如果为
null,则使用 trace 级别打印日志,不抛出异常
-
getIgnoreStatus
final Boolean getIgnoreStatus()
是否将返回结果没有
"status"的情况,当作调用成功。若开启此选项,明确出现网络问题或者明确指定
"status": "failed"才会当作调用失败。
-
setIgnoreStatus
final Unit setIgnoreStatus(Boolean ignoreStatus)
是否将返回结果没有
"status"的情况,当作调用成功。若开启此选项,明确出现网络问题或者明确指定
"status": "failed"才会当作调用失败。
-
builder
final static ActionContext.Builder builder(String action)
-
builder
final static ActionContext.Builder builder(String action, Consumer<ActionContext.Builder> block)
-
build
final static ActionContext build(String action, Consumer<ActionContext.Builder> block)
-
-
-