Skip to content

Index

kite-core / jp.co.cyberagent.kite.core

Package jp.co.cyberagent.kite.core

Types

Name Summary
AbstractKiteMutableState abstract class AbstractKiteMutableState<T> :KiteMutableState<T>
Inherits this abstract class to create custom KiteMutableState. When KiteMutableState.value changed, calls notifyChanged to notify its subscriber. When access the getter of KiteMutableState.value, calls subscribe to add itself as the dependency to any potential subscriber.
KiteContext interface KiteContext
Persistent context for the KiteDslScope. It behaves like a map.
KiteCoroutineDispatchers class KiteCoroutineDispatchers
A set of CoroutineDispatcher and will be set into the KiteContext. This allows the coroutine to become testable with providing testable CoroutineDispatcher.
KiteDslScope interface KiteDslScope : CoroutineScope
Define a scope for kite DSL. All kite DSL (like state, memo, etc) is an extension on KiteDslScope. KiteDslScope implements CoroutineScope so you can start coroutine via launch, and async.
KiteMemoScope interface KiteMemoScope
KiteMutableState interface KiteMutableState<T> :KiteState<T>
Represents a mutable KiteState that provided a setter for value. Do not implemented this interface directly, instead inherits the abstract class AbstractKiteMutableState.
KiteState interface KiteState<out T>
Represents a read-only state with single updatable value.
KiteStateCreator interface KiteStateCreator
Defines how to create KiteMutableState.
KiteSubscribeScope interface KiteSubscribeScope
Define a scope for subscribing a action to the change of some KiteStates automatically.
MainThreadChecker interface MainThreadChecker
A helper interface to determine current thread is main thread or not.
MutableKiteContext interface MutableKiteContext :KiteContext
A modifiable KiteContext.
Tuple3 data class Tuple3<out A, out B, out C>
Tuple4 data class Tuple4<out A, out B, out C, out D>
Tuple5 data class Tuple5<out A, out B, out C, out D, out E>
Tuple6 data class Tuple6<out A, out B, out C, out D, out E, out F>

Annotations

Name Summary
KiteDslMaker annotation class KiteDslMaker

Type Aliases

Name Summary
Invoker0 typealias Invoker0 = () ->Unit
Invoker1 typealias Invoker1<A> = (A) ->Unit
Invoker2 typealias Invoker2<A, B> = (A,B) ->Unit
Invoker3 typealias Invoker3<A, B, C> = (A,B,C) ->Unit
Invoker4 typealias Invoker4<A, B, C, D> = (A,B,C,D) ->Unit
Invoker5 typealias Invoker5<A, B, C, D, E> = (A,B,C,D,E) ->Unit
Invoker6 typealias Invoker6<A, B, C, D, E, F> = (A,B,C,D,E,F) ->Unit
KiteContextElement typealias KiteContextElement =Pair<Any,Any>
Tuple2 typealias Tuple2<A, B> =Pair<A,B>

Properties

Name Summary
defaultDispatcher valKiteDslScope.defaultDispatcher: CoroutineDispatcher
Returns the KiteCoroutineDispatchers.default in current context.
ioDispatcher valKiteDslScope.ioDispatcher: CoroutineDispatcher
Returns the KiteCoroutineDispatchers.io in this current context.
mainDispatcher valKiteDslScope.mainDispatcher: CoroutineDispatcher
Returns the KiteCoroutineDispatchers.main in current context.

Functions

Name Summary
asKiteContextElement fun <T :Any>T.asKiteContextElement():Pair<KClass<*>,Any>
Creates a KiteContextElement with the KClass
buildKiteContext fun buildKiteContext(builderAction:MutableKiteContext.() ->Unit):KiteContext
Builds a new KiteContext by populating a MutableKiteContext using the given builderAction.
checkIsMainThread funMainThreadChecker.checkIsMainThread(name:String):Unit
Asserts current thread is main thread. If it is not, then throws IllegalStateException.
getByType fun <T :Any>KiteContext.getByType():T?
Returns the value with its KClass as the key. If the key is not found then returns null.
getValue operator fun <T>KiteState<T>.getValue(thisRef:Nothing?, prop:KProperty<*>):T
Supports delegated property.
KiteContext fun KiteContext():KiteContext
Creates an empty KiteContext.
kiteContextOf fun kiteContextOf(vararg element:KiteContextElement):KiteContext
Returns a new KiteContext with the specified contents, given as a list of pairs where the first value is the key and the second is the value.
KiteDslScope fun KiteDslScope(coroutineScope: CoroutineScope, kiteContext:KiteContext):KiteDslScope
Create a simple KiteDslScope from coroutineScope. A default KiteCoroutineDispatchers instance will be set into the kiteContext if absent.
memo fun <T>KiteDslScope.memo(computation:KiteMemoScope.() ->T):KiteState<T>
Evaluate the computation during the computation. The evaluation result will be cached into a KiteState.
plusAssign operator funMutableKiteContext.plusAssign(element:KiteContextElement):Unit
Associates the key of element with its value. If the key already existed then throws IllegalStateException
require fun <T :Any>KiteContext.require(key:Any):T
Returns the value with the given key. If the key is not found then throws IllegalArgumentException.
requireByType fun <T :Any>KiteContext.requireByType():T
Returns the value with its KClass as the key. If the key is not found then throws IllegalArgumentException.
setByType fun <T :Any>MutableKiteContext.setByType(value:T):Unit
Associates the value with its KClass as the key. If the key already existed then throws IllegalStateException.
setValue operator fun <T>KiteMutableState<T>.setValue(thisRef:Nothing?, prop:KProperty<*>, value:T):Unit
Supports delegated property.
state fun <T>KiteDslScope.state(initialValue: () ->T):KiteMutableState<T>
Find the KiteStateCreator in current context and use it to create a KiteState with initialValue.
subscribe funKiteDslScope.subscribe(action:KiteSubscribeScope.() ->Unit):Unit
Run the action during the action.
update fun <T>KiteMutableState<T>.update(f: (curr:T) ->T):Unit
Updates the value with the result of function f has one parameter that receives current value.
withKiteContext funKiteDslScope.withKiteContext(context:KiteContext, block:KiteDslScope.() ->Unit):Unit
Calls the kite DSL with a given KiteContext.