ShapeShift️ - A Kotlin library for intelligent object mapping and conversion between objects

Related tags

Kotlin shapeshift
Overview

ShapeShift logo

ShapeShift️

A Kotlin library for intelligent object mapping and conversion between objects.

Maven Central Sonatype Nexus (Snapshots)

CircleCI Codecov GitHub contributions welcome

Documentation

To learn how to get started with ShapeShift, visit the official documentation website. You'll find in-depth documentation, tips and guides to help you get up and running.

Visit ShapeShift documentation

Installation

Maven

<dependency>
  <groupId>dev.krudgroupId>
  <artifactId>shapeshiftartifactId>
  <version>0.1.0version>
dependency>

Gradle

Groovy DSL

implementation 'dev.krud:shapeshift:0.1.0'

Kotlin DSL

implementation("dev.krud:shapeshift:0.1.0")

Requirements

  • Minimum supported Kotlin version: 1.6.X
  • Minimum supported Java version: 1.8

Examples

The example directory contains several independent scenarios for common use cases of this library.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. See CONTRIBUTING.md for more information.

License

ShapeShift is licensed under the MIT license. For more information, please see the LICENSE file.

Comments
  • Java use - warning: unknown enum constant kotlin.annotation.AnnotationTarget.ANNOTATION_CLASS

    Java use - warning: unknown enum constant kotlin.annotation.AnnotationTarget.ANNOTATION_CLASS

    When using the library in Java, the following warnings are sent to the log:

    warning: unknown enum constant kotlin.annotation.AnnotationTarget.ANNOTATION_CLASS
    warning: unknown enum constant kotlin.annotation.AnnotationTarget.CLASS
    warning: unknown enum constant kotlin.annotation.AnnotationTarget.FIELD
    warning: unknown enum constant kotlin.annotation.AnnotationTarget.CLASS
    
    bug core 
    opened by Idane 1
  • Java quality of life - Issues when creating a MappingTransformerRegistration

    Java quality of life - Issues when creating a MappingTransformerRegistration

    When instantiating a MappingTransformerRegistration in Java, if specifying generics the compiler fails with an obscure error, need to either create a helper method or solve the issues with the generics

    opened by Idane 0
  • Java use - Nullable/NotNull annotations

    Java use - Nullable/NotNull annotations

    Currently there are several issues when using the library in Java

    When implementing a transformer, condition, etc. the @NotNull and @Nullable annotations are added, at least in IntelliJ.

    1. For non-Android use, jetbrains-annotations is not bundled as a dependency
    2. For Android use, presumably, we'd need to bundle the android support annotations

    If we bundle either, we may have to split the packages

    enhancement core 
    opened by Idane 0
  • Add auto mapping capabilities

    Add auto mapping capabilities

    Currently, all mappings in ShapeShift are explicit and require a mapped field for each mapping that needs to be done. The goal of this issue is to change this and allow for implicit mappings where possible (same name, same type or transformable type via a default transformer).

    For a global approach, possibly add an automatic mapping strategy:

    • None
    • Same name, same type
    • Same name, all types (could throw an exception or echo a warning if no default transformer exists)
    enhancement core 
    opened by Idane 0
  • [Snyk] Upgrade org.jetbrains.kotlin:kotlin-stdlib-jdk8 from 1.6.21 to 1.7.0

    [Snyk] Upgrade org.jetbrains.kotlin:kotlin-stdlib-jdk8 from 1.6.21 to 1.7.0

    Snyk has created this PR to upgrade org.jetbrains.kotlin:kotlin-stdlib-jdk8 from 1.6.21 to 1.7.0.

    :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 4 versions ahead of your current version.
    • The recommended version was released 22 days ago, on 2022-06-08.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • [Snyk] Upgrade org.jetbrains.kotlin:kotlin-stdlib-jdk8 from 1.6.20 to 1.6.21

    [Snyk] Upgrade org.jetbrains.kotlin:kotlin-stdlib-jdk8 from 1.6.20 to 1.6.21

    This PR was automatically created by Snyk using the credentials of a real user.


    Snyk has created this PR to upgrade org.jetbrains.kotlin:kotlin-stdlib-jdk8 from 1.6.20 to 1.6.21.

    :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 1 version ahead of your current version.
    • The recommended version was released 22 days ago, on 2022-04-19.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by Idane 0
  • [Snyk] Upgrade org.slf4j:slf4j-api from 1.7.32 to 1.7.36

    [Snyk] Upgrade org.slf4j:slf4j-api from 1.7.32 to 1.7.36

    Snyk has created this PR to upgrade org.slf4j:slf4j-api from 1.7.32 to 1.7.36.

    :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


    • The recommended version is 4 versions ahead of your current version.
    • The recommended version was released 3 months ago, on 2022-02-08.

    Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

    For more information:

    🧐 View latest project report

    🛠 Adjust upgrade PR settings

    🔕 Ignore this dependency or unsubscribe from future upgrade PRs

    opened by snyk-bot 0
  • Add ability to create bean default transformer

    Add ability to create bean default transformer

    Currently, bean transformers in Spring can not be registered as default.

    1. For annotated transformers, we could add a @DefaultMappingTransformer annotation which will register the transformer as default
    2. For transformers declared as beans from JavaConfig/XML, maybe we could add a construct similar to FilterRegistration, where additional information on the transformer is defined, could also utilize the existing TransformerRegistration for this purpose
    enhancement spring starter 
    opened by Idane 0
  • Support mapping of classes without default constructor

    Support mapping of classes without default constructor

    When mapping to a class reference, one approach is to throw an exception if not all mapped fields correlate to the fields in the constructor.

    data class PersonRecord(
        @MappedField
        val firstName: String,
        @MappedField
        val lastName: String,
        @MappedField
        val age: Int,
        val tel: String
    )
    
    data class PersonRecord(
        val firstName: String,
        val lastName: String,
        val age: Int
    )
    

    This requires changing the logic of how we do mapping currently. Instead of mapping right before assignments, we need to prepare all mappings in advance and then attempt to correlate the mapFroms to the constructor argument names. If not all arguments match and no default constructor is available, throw an exception.

    enhancement core 
    opened by Idane 0
Releases(v0.7.0)
  • v0.7.0(Nov 6, 2022)

  • v0.6.0(Sep 5, 2022)

    Features

    • add MappingDefinitionBuilder as an alternative to the Kotlin DSL (291fb44)
    • add additional withTransformer, withDecorator overloads to the ShapeShift Builder (46911ce)
    • add automap option to the Mapping Definition Builder (bca9548)
    • add transformer/condition class reference overloads to the Mapping Definition Builder (70ac909)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Aug 9, 2022)

  • v0.4.0(Jul 21, 2022)

  • v0.3.0(Jul 18, 2022)

  • v0.2.0(Jul 11, 2022)

    Bug Fixes

    • change ClassPair to own data class (5dd5322)
    • Change error message when a field is not found (9bb080b)

    Features

    • add ad hoc transformers (8998f34)
    • add conditions (fb67786)
    • add decorator registration (794390f)
    • add decorators (43572f9)
    • add default transformers (4b855ea)
    • add programmatic resolver (a61d0c6)
    • add resolver abstraction (efa1f31)
    • change decorators and transformers to use a context object (757e8fa)
    • change transformers list to set (c5841b6)
    • change way transformers are registered (7238424)
    • remove concrete type from field transformers (c9b8f8d)
    • spring: add support for bean decorators (2cbcdd4)
    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(May 20, 2022)

    Bug Fixes

    • add missing shapeshift dependency to the spring boot starter (8686f56)
    • fix bug with toPath handling with qualifier (2a2b4de)
    • fix bug with transformers of primitive types not unboxing (409da96)
    • misc renames, misc visibility modifiers (1c87f0d)
    • remove unused reflection method (5d4d964)
    • rename FieldMapper to ShapeShift (58d725c)
    • upgrade org.slf4j:slf4j-api from 1.7.32 to 1.7.36 (dae7c41)

    Features

    • add ShapeShiftBuilder (73bb37f)
    • add withTransformer to ShapeShift builder without TransformerRegistration (fd70454)
    • change FieldTransformer from, to types to vals (5c8ad83)
    • kotlin refactor (9585331)
    • throw exception if transformer was not found (a0120f8)
    Source code(tar.gz)
    Source code(zip)
Owner
KRUD
KRUD
ViaBackwardsTranslator - A tool to translate ViaBackwards mapping locale

ViaBackwardsTranslator A tool to translate ViaBackwards mapping locale. How to O

null 2 Sep 30, 2022
A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisation and okio

Store A tiny Kotlin multiplatform library that assists in saving and restoring objects to and from disk using kotlinx.coroutines, kotlinx.serialisatio

Isuru Rajapakse 98 Jan 3, 2023
AppConversorMoedas - The currency conversion using an API to bring the data up to date

LAB - Criando um app de conversor moedas/cambio com Kotlin. O curso pode ser ace

Davi Braga 0 Jan 1, 2022
A kotlin library of extension functions that add smalltalk style methods to objects.

KtTalk A kotlin library of extension functions that add smalltalk style methods to objects. Motivation Smalltalk is a pure OO language in which everyt

null 11 Oct 16, 2021
Kotlin Object Notation - Lightweight DSL to build fluid JSON trees

Kotlin Object Notation Lightweight kotlin MPP DSL for building JSON trees Setup Just drop the dependency in your commonMain sourceSet kotlin { sourc

Martynas Petuška 43 Dec 10, 2022
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
EVMapper: Simple object mapper for Kotlin

EVMapper - Simple object mapper for Kotlin Simple mapping data class AData(val p1: Int, val p2: Int) data class BData(val p1: Int, val p2: Int) val a

Igor 8 Jan 24, 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
Link-converter - A web service that converts links between web url and deeplink for mobile and web applications

Deep Link Converter Linkleri, mobil ve web uygulamaları için web url ile deeplin

Muhammed Eren DURSUN 2 Apr 9, 2022
Demonstrating Micronaut 3.1.3 conflict between caches in application.yml and MicronautCaffeineCacheMetrics.monitor

This application illustrates an issue with using a caches section in application.yml in conjunction with MicronautCaffeineCacheMetrics.monitor. The co

Mark Fisher 0 Nov 4, 2021
A simple project that describes the relationship between the view and it's viewmodel in android development

View-ViewModel-Communication A simple project that describes the relationship between the view and it's viewmodel in android development In MVVM archi

Segun Francis 1 Nov 6, 2021
An application for converting between units

currency-converter This is an Android Based Application for helping users convert between currencies. The project is part of our Android Jam Series La

MMU CIT CLUB 2 Nov 5, 2021
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Practical Kotlin Multiplatform on the Web 본 저장소는 코틀린 멀티플랫폼 기반 웹 프로그래밍 워크숍(강좌)을 위해 작성된 템플릿 프로젝트가 있는 곳입니다. 워크숍 과정에서 코틀린 멀티플랫폼을 기반으로 프론트엔드(front-end)는 Ko

SpringRunner 14 Nov 5, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Building a Full Stack Web App with Kotlin Multiplatform 본 저장소는 INFCON 2022에서 코틀린 멀티플랫폼 기반 웹 프로그래밍 핸즈온랩을 위해 작성된 템플릿 프로젝트가 있는 곳입니다. 핸즈온 과정에서 코틀린 멀티플랫폼을

Arawn Park 19 Sep 8, 2022
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.

Lychee (ex. reactive-properties) Lychee is a library to rule all the data. ToC Approach to declaring data Properties Other data-binding libraries Prop

Mike 112 Dec 9, 2022
Functional Kotlin & Arrow based library for generating and verifying JWTs and JWSs

kJWT Functional Kotlin & Arrow based library for generating and verifying JWTs and JWSs. JWS JWT The following Algorithms are supported: HS256 HS384 H

Peter vR 31 Dec 25, 2022
Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs

Zipline This library streamlines using Kotlin/JS libraries from Kotlin/JVM and Kotlin/Native programs. It makes it possible to do continuous deploymen

Cash App 1.5k Dec 30, 2022
Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in Kotlin with Jetpack Compose and a backed in Kotlin hosted on AppEngine.

Conferences4Hall Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in K

Gérard Paligot 98 Dec 15, 2022