EntityAdapter

interface EntityAdapter<T>

Interface for adapters that handle the mapping between domain entities and Storage storage structures.

Usually generated by the Storage KSP compiler for classes annotated with @Entity.

Properties

Link copied to clipboard
abstract val type: String

The unique type identifier for this entity class.

Functions

Link copied to clipboard
abstract fun fromSnapshot(snapshot: Snapshot): T

Reconstructs an entity instance from a Storage storage snapshot.

Link copied to clipboard
abstract fun getId(entity: T): String

Extracts the unique identifier from an entity instance.

Link copied to clipboard
abstract fun toMap(entity: T): Map<String, Any>

Maps the entity properties to a flat key-value map for storage.