EventInterceptorsGenerator

事件拦截器的生成/构建器,用于 SimpleListenerManagerConfiguration 中。

事件流程拦截器

你可以通过 processingIntercept 等相关函数提供针对整个事件流程的拦截器.

// Kotlin
processingIntercept {
// do..

it.proceed()
}

processingIntercept(id = randomID(), priority = PriorityConstant.FIRST) {
// do..

it.proceed()
}
// Java
generator
.processingIntercept(Identifies.randomID(), PriorityConstant.FIRST, context -> {
// do...
return context.proceedBlocking();
})
.processingIntercept(Identifies.randomID(), PriorityConstant.FIRST, context -> {
// do...
return context.proceedBlocking();
})
.end() // back to config
// ...
;

监听函数拦截器

你可以通过 listenerIntercept 等相关函数提供针对每个监听函数的拦截器.

// Kotlin
listenerIntercept {
// do...

it.proceed()
}
listenerIntercept(id = randomID(), priority = PriorityConstant.FIRST) {
// do...
it.proceed()
}
// Java
generator
.listenerIntercept(Identifies.randomID(), PriorityConstant.FIRST, context -> {
// do...
return context.proceedBlocking();
})
.listenerIntercept(Identifies.randomID(), PriorityConstant.FIRST, context -> {
// do...
return context.proceedBlocking();
})
.end() // back to config
// ...
;

Constructors

Functions

Link copied to clipboard

提供一个 id拦截器, 向内部注册一个对应的拦截器。

fun listenerIntercept(id: String, point: EventListenerInterceptor.Point = EventListenerInterceptor.Point.DEFAULT, priority: Int = PriorityConstant.NORMAL, interceptFunction: suspend (EventListenerInterceptor.Context) -> EventResult): EventInterceptorsGenerator

提供一个 id, 优先级拦截函数, 得到一个流程拦截器 EventListenerInterceptor.

fun listenerIntercept(id: ID = randomID(), point: EventListenerInterceptor.Point = EventListenerInterceptor.Point.DEFAULT, priority: Int = PriorityConstant.NORMAL, interceptFunction: suspend (EventListenerInterceptor.Context) -> EventResult): EventInterceptorsGenerator

提供一个 id, 优先级拦截函数, 向内部注册一个对应的拦截器。

Link copied to clipboard

提供一个 id拦截器 实例。

fun processingIntercept(id: String, priority: Int = PriorityConstant.NORMAL, interceptFunction: suspend (EventProcessingInterceptor.Context) -> EventProcessingResult): EventInterceptorsGenerator

fun processingIntercept(id: ID = randomID(), priority: Int = PriorityConstant.NORMAL, interceptFunction: suspend (EventProcessingInterceptor.Context) -> EventProcessingResult): EventInterceptorsGenerator

提供一个 id, 优先级拦截函数,在内部构建一个拦截器。

Properties