EVMapper: Simple object mapper for Kotlin

Related tags

Kotlin EVMapper
Overview

EVMapper - Simple object mapper for Kotlin

contributions welcome

Simple mapping

data class AData(val p1: Int, val p2: Int)
data class BData(val p1: Int, val p2: Int)

val aData = AData(1, 2)
val bData = aData.mapTo<BData> {}

Mapping with binding

data class AData(val p1: Int, val p2: Int)
data class BData(val p1: Int, val p3: Int)

val aData = AData(1, 2)
val bData = aData.mapTo<BData> {
    binds = listOf(
        Bind<Int, Int>("p2" to "p3")
    )
}

Mapping with binding and type converting

data class AData(val p1: Int, val p2: Int)
data class BData(val p1: String, val p2: String)

val aData = AData(1, 2)
val bData = aData.mapTo<BData> {
    binds = listOf(
        Bind<Int, String>("p1" to "p1", Convert { it.toString() }),
        Bind<Int, String>("p2" to "p2", Convert { it.toString() })
    )
}

Mapping global converting

data class AData(val p1: Instant, val p2: Instant)
data class BData(val p1: LocalDateTime, val p2: LocalDateTime)

val aData = AData(Instant.now(), Instant.now())
val bData = aData.mapTo<BData> {
    converters = listOf(
        Convert<Instant, LocalDateTime> { LocalDateTime.ofInstant(it, ZoneOffset.UTC) }
    )
}

How to install

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

dependencies {
    implementation("com.github.ipleac:EVMapper:v0.1")
}
You might also like...
A simple 'Slide to Unlock' Material widget for Android, written in Kotlin 📱🎨🦄
A simple 'Slide to Unlock' Material widget for Android, written in Kotlin 📱🎨🦄

Slide To Act A simple Slide to Unlock Material widget for Android, written in Kotlin 🇰. Getting Started Example Features Attributes area_margin inner

A simple demo that shows how WebWorkers can be used in Kotlin/JS

Web Workers in KotlinJS This repo demonstrates how to set up a Web Worker in Kotlin/JS. It is a very simple demo that creates a new worker that sends

🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)
🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)

Haru 🚟 Lightweight, and simple scheduling library made for Kotlin (JVM) Why did you build this? I built this library as a personal usage library to h

Simple Kotlin Multiplatform PrayerTimes App for iOS and Android

Kotlin Multiplatform ___ _______ ___ / _ \_______ ___ _____ ___/_ __(_)_ _ ___ ___ / _ | __

A lightweight and simple Kotlin library for deep link handling on Android 🔗.

A lightweight and simple Kotlin library for deep link handling on Android 🔗.

Simple State Machines in Kotlin (KSSM)
Simple State Machines in Kotlin (KSSM)

Simple State Machines in Kotlin (KSSM) What is this? KSSM (reordered: Kotlin - Simple State Machines) provides an easy and simple DSL (Domain Specific

A simple Football Live Score project using Kotlin.
A simple Football Live Score project using Kotlin.

Football Live Score App (Kotlin) A simple Malaysian Football Live Score project using Kotlin. Started on Aug 2020. Project terminated. Self-developed

An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.
An example of a test task for creating a simple currency converter application for the Android platform. The app is developed using Kotlin, MVI, Dagger Hilt, Retrofit, Jetpack Compose.

Simple Currency Converter Simple Currency Converter Android App by Isaev Semyon An example of a test task for creating a simple currency converter app

A simple Kotlin multi-platform abstraction around the javax.inject annotations.

Inject A simple Kotlin multi-platform abstraction around the javax.inject annotations. This allows using the annotations in Kotlin common code so that

Releases(v0.1)
Owner
Igor
Igor
Kotlin Android object for global applicationContext

ContextProvider Kotlin Android object for global applicationContext Usage In your Aplication class class YourApp : Application() { override fun o

PaulRB 0 Nov 4, 2021
ShapeShift️ - A Kotlin library for intelligent object mapping and conversion between objects

ShapeShift️ A Kotlin library for intelligent object mapping and conversion between objects. Documentation Installation Maven Gradle Groovy DSL Kotlin

KRUD 127 Dec 7, 2022
A modular object storage framework for Kotlin multiplatform projects.

ObjectStore A modular object storage framework for Kotlin multiplatform projects. Usage ObjectStore provides a simple key/value storage interface whic

Drew Carlson 4 Nov 10, 2022
A thought experiment on architecture, object-oriented programming, and composability.

Journal3 There's barely anything special about the features that Journal3 is offering, it's literally yet another journaling application. What is spec

Hadi Satrio 7 Dec 13, 2022
RoomJetpackCompose is an app written in Kotlin and shows a simple solution to perform CRUD operations in the Room database using Kotlin Flow in clean architecture.

RoomJetpackCompose is an app written in Kotlin and shows a simple solution to perform CRUD operations in the Room database using Kotlin Flow in clean architecture.

Alex 27 Jan 1, 2023
Simple and light-weight event dispatcher for Kotlin

KDispatcher is a Kotlin EventDispatcher This is light-weight event dispatcher based on KOTLIN priority: Int? = null to subscribe function for sorting

Alexandr Minkin 63 Oct 3, 2022
Nice and simple DSL for Espresso in Kotlin

Kakao Nice and simple DSL for Espresso in Kotlin Introduction At Agoda, we have more than 1000 automated tests to ensure our application's quality and

Agoda Company Pte Ltd. 1.1k Nov 22, 2022
A simple Kotlin wrapper around Anvil.

AnvilKotlin A simple Kotlin wrapper around Anvil. The only purpose of this library is to provide type safety to Anvil through Kotlin. Nothing more, no

Andre Artus 15 Oct 3, 2022
A simple way to handle remote image in Kotlin.

Parrot A kotlin extension to load easily remote images in your ImageView. Install Add to gradle in allprojects maven { url 'https://jitpack.io' } the

Matteo Crippa 22 Oct 3, 2022
Dead simple EventBus for Android made with Kotlin and RxJava 2

KBus Super lightweight (13 LOC) and minimalistic (post(), subscribe(), unsubscribe()) EventBus written with idiomatic Kotlin and RxJava 2 KBus in 3 st

Adriel Café 46 Dec 6, 2022