Package-level declarations

Types

Link copied to clipboard
typealias AfterCellExecutionCallback = KotlinKernelHost.(snippetInstance: Any, result: FieldValue) -> Unit
Link copied to clipboard

Simple implementation for RendererTypeHandler. Renders any type by default

Link copied to clipboard
class ClassAnnotationHandler(val annotation: KClass<out Annotation>, val callback: ClassDeclarationsCallback)

Annotation handler used to hook class declarations with specific annotations

Link copied to clipboard

Callback to handle new class or interface declarations in executed snippets

Link copied to clipboard
typealias Code = String

Type alias for plain code ready for execution

Link copied to clipboard
interface CodeCell

Single evaluated notebook cell representation

Link copied to clipboard

Preprocesses the cell code before its execution

Link copied to clipboard
Link copied to clipboard
interface DeclarationInfo
Link copied to clipboard
Link copied to clipboard

Container that holds all notebook display results

Link copied to clipboard

Display result that may be converted to JSON for display_data kernel response

Link copied to clipboard

Display result that holds the reference to related cell

Link copied to clipboard
@Serializable
class ExactRendererTypeHandler(val className: TypeName, val execution: ResultHandlerCodeExecution) : RendererTypeHandler

Serializable version of type handler. Renders only classes which exactly match className by FQN. Accepts only ResultHandlerCodeExecution because it's the only one that may be correctly serialized.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface FieldHandler
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun interface FieldHandlerExecution<T>
Link copied to clipboard
Link copied to clipboard
data class FieldHandlerWithPriority(val handler: FieldHandler, val priority: Int)
Link copied to clipboard
class FieldInfo(val kotlinProperty: KProperty<*>?, val javaField: Field)
Link copied to clipboard
Link copied to clipboard
data class FieldValue(val value: Any?, val name: String?, typeProvider: KTypeProvider?)
Link copied to clipboard
class FileAnnotationHandler(val annotation: KClass<out Annotation>, val callback: FileAnnotationCallback)
Link copied to clipboard
data class HtmlData(val style: String, val body: String, val script: String)
Link copied to clipboard
class InMemoryMimeTypedResult(val inMemoryOutput: InMemoryResult, val fallbackResult: Map<String, JsonElement>) : DisplayResult

Wrapper for DisplayResults that contain in memory results. This is only applicable to the embedded server.

Link copied to clipboard

Mimetypes for in-memory output.

Link copied to clipboard
data class InMemoryResult(val mimeType: String, val result: Any?)

Wrapper for in-memory results that also tracks its corresponding mime-type.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface JREInfoProvider

Provides information about used Java runtime

Link copied to clipboard

Jupyter client which is used for running the instance of a kernel

Link copied to clipboard

Factory interface for creating slf4j-compatible loggers.

Link copied to clipboard

Interface representing kernel engine, the core facility for compiling and executing code snippets

Link copied to clipboard

Kotlin kernel version, with full specification, Comparable implementation and serialization/deserialization

Link copied to clipboard
fun interface KTypeProvider
Link copied to clipboard
interface LibraryLoader

Loads library definitions given the LibrariesScanResult. Usually used in loadLibraryDefinitions or loadLibraryProducers

Link copied to clipboard
class MimeTypedResult(mimeData: Map<String, String>, isolatedHtml: Boolean = false, val id: String? = null) : MimeTypedResultEx, Map<String, String>

Convenient implementation of DisplayResult, supposed to be used almost always.

Link copied to clipboard
open class MimeTypedResultEx(mimeData: JsonElement, val id: String? = null, metadataModifiers: List<MetadataModifier> = emptyList()) : DisplayResult
Link copied to clipboard
object MimeTypes
Link copied to clipboard
typealias MutableJsonObject = MutableMap<String, JsonElement>
Link copied to clipboard
interface Notebook

Notebook is a main entry point for Kotlin Jupyter API

Link copied to clipboard
Link copied to clipboard

Precompiled renderer type handler. Override this interface if you want type rendering to be optimized.

Link copied to clipboard
Link copied to clipboard
interface Renderable

Object that should be rendered to DisplayResult if it is the result of code cell

Link copied to clipboard
Link copied to clipboard

RendererHandler renders results for which accepts returns true

Link copied to clipboard
data class RendererHandlerWithPriority(val renderer: RendererFieldHandler, val priority: Int = ProcessingPriority.DEFAULT)
Link copied to clipboard

RenderersProcessor is responsible for rendering objects. You may use it to render values exactly like notebook renders results, and also register new renderers in runtime.

Link copied to clipboard

RendererTypeHandler handles results for which runtime types acceptsType returns true

Link copied to clipboard
class ResultFieldUpdateHandler(val updateCondition: (value: Any?, field: Field) -> Boolean, updateAction: (host: KotlinKernelHost, value: Any?, field: Field) -> VariableName?) : FieldHandlerEx
Link copied to clipboard

Execution represented by code snippet. This snippet should return the value.

Link copied to clipboard

Execution interface for type handlers

Link copied to clipboard
fun interface ResultsAccessor

Execution results accessor interface

Link copied to clipboard
interface SessionOptions
Link copied to clipboard

Renders any object of superType (including subtypes). If execution is ResultHandlerCodeExecution, this renderer may be optimized by pre-compilation (unlike ExactRendererTypeHandler).

Link copied to clipboard
class SubtypeThrowableRenderer<E : Throwable>(superType: KClass<E>, renderer: (E) -> Any) : ThrowableRenderer
Link copied to clipboard
fun interface TextRenderer
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class TextRendererWithPriority(val renderer: TextRenderer, val priority: Int = ProcessingPriority.DEFAULT)
Link copied to clipboard
Link copied to clipboard
typealias TypeName = String

Type alias for FQNs - fully qualified names of classes

Link copied to clipboard
data class VariableDeclaration(val name: VariableName, val value: Any?, val type: KType, val isMutable: Boolean = false)
Link copied to clipboard
typealias VariableName = String
Link copied to clipboard
interface VariableState
Link copied to clipboard
data class VariableStateImpl(val property: KProperty1<Any, *>, val scriptInstance: Any) : VariableState
Link copied to clipboard

Properties

Link copied to clipboard

Renders any array (primitive or non-primitive) into a list.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Renders a Swing JComponent in-memory, but also provides a screenshot of the UI as fallback data.

Link copied to clipboard

Renders a Swing JDialog in-memory, but also provides a screenshot of the UI as fallback data.

Link copied to clipboard

Renders a Swing JFrame in-memory, but also provides a screenshot of the UI as fallback data.

Link copied to clipboard

This prefix is used for creating temporary properties names, and variables which names start from this prefix are not processed by FieldHandler processor

Functions

Link copied to clipboard
fun JsonObject.containsDisplayId(id: String): Boolean

Check if the JSON object contains a display_id entry.

Link copied to clipboard
inline fun <T : Any> createRenderer(crossinline renderAction: (T) -> Any?): RendererFieldHandler
inline fun createRenderer(crossinline renderCondition: (FieldValue) -> Boolean, crossinline renderAction: (FieldValue) -> Any?): RendererFieldHandler
inline fun createRenderer(crossinline renderCondition: (FieldValue) -> Boolean, crossinline renderAction: (KotlinKernelHost, FieldValue) -> Any?): RendererFieldHandler
inline fun <T : Any> createRenderer(kClass: KClass<T>, crossinline renderAction: (T) -> Any?): RendererFieldHandler
Link copied to clipboard
inline fun <T : Any> createRendererByCompileTimeType(crossinline renderAction: (FieldValue) -> Any?): RendererFieldHandler
inline fun createRendererByCompileTimeType(kType: KType, crossinline renderAction: (FieldValue) -> Any?): RendererFieldHandler
Link copied to clipboard
Link copied to clipboard
fun encodeBufferedImage(image: BufferedImage): JsonPrimitive

Convert a buffered image to a PNG file encoded as a Base64 Json string.

Link copied to clipboard
fun KernelLoggerFactory.getLogger(kClass: KClass<*>): Logger
Link copied to clipboard
fun HTML(text: String, isolated: Boolean = false): MimeTypedResult
Link copied to clipboard
fun htmlResult(text: String, isolated: Boolean = false): MimeTypedResult
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun JSON(jsonText: String, isolated: Boolean = false, expanded: Boolean = true): MimeTypedResultEx
fun JSON(json: JsonElement, isolated: Boolean = false, expanded: Boolean = true): MimeTypedResultEx
Link copied to clipboard
inline fun <T> KernelLoggerFactory.logger(): Logger
Link copied to clipboard
fun MIME(vararg mimeToData: Pair<String, String>): MimeTypedResult
Link copied to clipboard
fun mimeResult(vararg mimeToData: Pair<String, String>): MimeTypedResult
Link copied to clipboard
Link copied to clipboard

Renders HTML as iframe in Kotlin Notebook or simply in other clients

Link copied to clipboard
fun MutableJsonObject.setDisplayId(id: String? = null, force: Boolean = false): String?

Sets display ID to JSON. If ID was not set, sets it to id and returns it back If ID was set and force is false, just returns old ID If ID was set, force is true and id is null, just returns old ID If ID was set, force is true and id is not null, sets ID to id and returns it back

Link copied to clipboard

Takes a screenshot of the Swing component. This is only possible if the component has been given a size, see JComponent.getSize. Either manually or through a java.awt.LayoutManager.

Takes a screenshot of a JDialog.

Takes a screenshot of a JFrame.

Link copied to clipboard
Link copied to clipboard
fun DisplayResult?.toJson(): JsonObject

Convenience method for converting nullable DisplayResult to JSON

Link copied to clipboard