Effortless, type-safe object-to-object mapping in Kotlin. Tired of writing boilerplate code to convert one object to another? This library does it for you at compile time, with full support for Kotlin Multiplatform.
Kotlin AutoMapper uses KSP (Kotlin Symbol Processing) to generate extension functions that automatically map your data, enum, and sealed classes. No reflection, no runtime magic - just pure, fast, and safe generated code for all your targets.
➡️ View the full documentation for Setup, How to Use, and Advanced Usage ⬅️
- Kotlin Multiplatform First: Works seamlessly across
JVM,iOS,JS,Wasm, and other Kotlin targets. - Type-Safe & Compile-Time Verified: All mappings are generated and validated by KSP at compile time. No reflection, no runtime errors.
- Zero Runtime Dependencies: The annotation library is
SOURCE-only and adds no overhead to your production app. - Broad Class Support: Out-of-the-box support for
data,enum, andsealedclasses, including complex nested hierarchies. - Powerful Mapping Customization:
- Property Renaming: Easily map properties with different names using
@PropertyMapping. - Default Values: Provide fallback values for missing or
nullproperties with@DefaultValue.
- Property Renaming: Easily map properties with different names using
- Advanced Type Conversion:
- Custom Converters: Define your own conversion logic for complex types (like
UuidorInstant) using@AutoConverter. - Automatic Primitive Conversion: Handles conversions between primitives like
Int,Long,Stringautomatically.
- Custom Converters: Define your own conversion logic for complex types (like
- Smart & Safe Generation:
- Bidirectional Mapping: Generate forward and reverse mappings with a single
reversible = trueflag. - Visibility Control: Generated code automatically inherits the visibility (
publicorinternal) of your@AutoMapperModule. @OptInPropagation: Automatically propagates@OptInannotations from your custom converters to the generated functions, ensuring compile-time safety for experimental APIs.
- Bidirectional Mapping: Generate forward and reverse mappings with a single
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.