W3cubDocs

/Kotlin

AbstractCoroutineContextElement

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)
abstract class AbstractCoroutineContextElement : Element

Base class for CoroutineContext.Element implementations.

Constructors

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

<init>

Base class for CoroutineContext.Element implementations.

AbstractCoroutineContextElement(key: Key<*>)

Properties

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)

key

A key of this coroutine context element.

open val key: Key<*>

Extension Functions

Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)

getPolymorphicElement

Returns the current element if it is associated with the given key in a polymorphic manner or null otherwise. This method returns non-null value if either Element.key is equal to the given key or if the key is associated with Element.key via AbstractCoroutineContextKey. See AbstractCoroutineContextKey for the example of usage.

fun <E : Element> Element.getPolymorphicElement(
    key: Key<E>
): E?
Platform and version requirements: JVM (1.3), JS (1.3), Native (1.3)

minusPolymorphicKey

Returns empty coroutine context if the element is associated with the given key in a polymorphic manner or null otherwise. This method returns empty context if either Element.key is equal to the given key or if the key is associated with Element.key via AbstractCoroutineContextKey. See AbstractCoroutineContextKey for the example of usage.

fun Element.minusPolymorphicKey(
    key: Key<*>
): CoroutineContext

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/-abstract-coroutine-context-element/index.html