EventInterceptorsGenerator
事件拦截器的生成/构建器,用于 SimpleListenerManagerConfiguration 中。
事件流程拦截器
你可以通过 processingIntercept 等相关函数提供针对整个事件流程的拦截器.
// Kotlin
processingIntercept {
// do..
it.proceed()
}
processingIntercept(id = randomID(), priority = PriorityConstant.FIRST) {
// do..
it.proceed()
}
Content copied to clipboard
// 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
// ...
;
Content copied to clipboard
监听函数拦截器
你可以通过 listenerIntercept 等相关函数提供针对每个监听函数的拦截器.
// Kotlin
listenerIntercept {
// do...
it.proceed()
}
listenerIntercept(id = randomID(), priority = PriorityConstant.FIRST) {
// do...
it.proceed()
}
Content copied to clipboard
// 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
// ...
;
Content copied to clipboard
Functions
Link copied to clipboard
fun listenerIntercept(id: String, interceptor: EventListenerInterceptor): EventInterceptorsGenerator
fun listenerIntercept(id: ID = randomID(), interceptor: EventListenerInterceptor): EventInterceptorsGenerator
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
Link copied to clipboard
fun processingIntercept(id: String, interceptor: EventProcessingInterceptor): EventInterceptorsGenerator
fun processingIntercept(id: ID = randomID(), interceptor: EventProcessingInterceptor): EventInterceptorsGenerator
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