Interceptor

public final class Interceptor<INTERACTION extends Object, ASSERTION extends Object, ACTION extends Object>

Base class for intercepting the call chain from Kakao to Espresso.

Interceptors can be provided through Kakao runtime, different Screens as well as KViews.

Interceptors are stacked during the runtime for any Kakao-Espresso check and perform operations. The stack ordering is following: KView interceptor -> Screen interceptors -> Kakao interceptor.

Any of the interceptors in the chain can break the chain call by setting isOverride to true in onCheck, onPerform or onAll interception functions during the configuration. Doing this will not only prevent underlying interceptors from being invoked, but prevents Kakao from executing the operation. In that case, responsibility for actually making Espresso call lies on developer.

For each operation the interceptor invocation cycle will be as follows:

// For check operation
onAll?.invoke()
onCheck?.invoke()

// For perform operation
onAll?.invoke()
onPerform?.invoke()

See also

Constructors

Link copied to clipboard
public Interceptor<INTERACTION, ASSERTION, ACTION> Interceptor<INTERACTION extends Any, ASSERTION extends Any, ACTION extends Any>(Interception<Function2<INTERACTION, ASSERTION, Unit>> onCheck, Interception<Function2<INTERACTION, ACTION, Unit>> onPerform, Interception<Function1<INTERACTION, Unit>> onAll)

Types

Link copied to clipboard
public final class Builder<INTERACTION extends Object, ASSERTION extends Object, ACTION extends Object>

Builder class that is used to build a single instance of Interceptor.

Link copied to clipboard
public final class Configuration
Link copied to clipboard
public final class Configurator

Configuration class that is used for building interceptors on the Kakao runtime and Screen levels.

Properties

Link copied to clipboard
private final Interception<Function1<INTERACTION, Unit>> onAll
Link copied to clipboard
private final Interception<Function2<INTERACTION, ASSERTION, Unit>> onCheck
Link copied to clipboard
private final Interception<Function2<INTERACTION, ACTION, Unit>> onPerform

Functions

Link copied to clipboard
public final Interception<Function1<INTERACTION, Unit>> getOnAll()
Link copied to clipboard
public final Interception<Function2<INTERACTION, ASSERTION, Unit>> getOnCheck()
Link copied to clipboard
public final Interception<Function2<INTERACTION, ACTION, Unit>> getOnPerform()