abstract class BaseHook<F : Function<*>> : Hook
Fields
Name | Description |
---|---|
protected var taps: List<TapInfo<F>>
|
|
protected open interceptors: Interceptors<F>
|
Constructors
<init>
constructor(type: String)
Parameters
Name | Description |
---|---|
type: String
|
Methods
tap
fun tap(name: String, f: F): String?
Parameters
Name | Description |
---|---|
name: String
|
human-readable identifier to make debugging easier |
f: F
|
ReturnValue
Name | Description |
---|---|
String?
|
an auto generated identifier token that can be used to untap, null if tap was rejected by any of the register interceptors. |
tap
fun tap(name: String, id: String, f: F): String?
Tap the hook with f.
Parameters
Name | Description |
---|---|
name: String
|
human-readable identifier to make debugging easier |
id: String
|
identifier token to register the f callback with. If another tap exists with the same id, it will be overridden, which essentially shortcuts an untap call. |
f: F
|
ReturnValue
Name | Description |
---|---|
String?
|
identifier token that can be used to untap, null if tap was rejected by any of the register interceptors. |
untap
fun untap(id: String)
Remove tapped callback associated with the id returned from tap
Parameters
Name | Description |
---|---|
id: String
|
ReturnValue
Name | Description |
---|---|
Unit
|
interceptTap
fun interceptTap(f: (HookContext, TapInfo<F>)->Unit)
Parameters
Name | Description |
---|---|
f: (HookContext, TapInfo<F>)->Unit
|
ReturnValue
Name | Description |
---|---|
Unit
|
interceptCall
fun interceptCall(f: F)
Parameters
Name | Description |
---|---|
f: F
|
ReturnValue
Name | Description |
---|---|
Unit
|
interceptRegister
fun interceptRegister(f: (TapInfo<F>)->TapInfo<F>?)
ReturnValue
Name | Description |
---|---|
Unit
|
generateRandomId
protected open fun generateRandomId(): String
Method to generate a random identifier for managing TapInfos
ReturnValue
Name | Description |
---|---|
String
|
Tap the hook with f.