BoomerangFormat

open class BoomerangFormat(val serializersModule: SerializersModule = EmptySerializersModule())(source)

A small adapter that bridges Kotlinx Serialization with Boomerang.

BoomerangFormat provides serialize/deserialize helpers that convert between arbitrary @Serializable objects and the Boomerang key–value container used throughout the Boomerang ecosystem (core, fragment, compose, etc.).

Configuration

  • You can pass a custom serializersModule to register polymorphic serializers, custom serializers, and context-aware serialization.

  • A singleton, lazily configurable instance is exposed via companion object. You can globally replace it using BoomerangConfig.format.

Thread-safety

  • Instances are immutable and can be safely shared across threads.

Typical usage

@Serializable data class User(val id: String)

// Serialize to a Boomerang
val b: Boomerang = BoomerangFormat.serialize(User("42"))

// Deserialize back
val u: User = BoomerangFormat.deserialize(b)

// Or configure globally for extension functions in this module
BoomerangConfig.format = BoomerangFormat {
serializersModule = SerializersModule { /* polymorphic {} etc. */}
}

Inheritors

Constructors

Link copied to clipboard
constructor(serializersModule: SerializersModule = EmptySerializersModule())

Types

Link copied to clipboard

Default singleton-format and a lightweight builder API.

Properties

Link copied to clipboard
val serializersModule: SerializersModule

The Kotlinx Serialization SerializersModule used for resolving contextual, polymorphic, and custom serializers during encode/decode. Defaults to EmptySerializersModule.

Functions

Link copied to clipboard
inline fun <T : Any> deserialize(boomerang: Boomerang): T

Deserializes a value of type T from the provided boomerang.

Link copied to clipboard
inline fun <T : Any> serialize(value: T): Boomerang

Serializes the given value of type T into a Boomerang.