Skip to content

DynamoDB Enhanced to support immutable Kotlin data classes #2096

Open
@tekener

Description

@tekener

In Kotlin your goal is to use data classes as immutable. With the current mapper this is not possible. You have to add an parameter less constructor to the class (noargs plugin) and all fields has to be changeable (var's instead val's)

Example:
data class Example(val name:String) and not data class Example(var name:String)

Describe the Feature

The DynamoDB Enhanced mapper should call the constructor with all attributes read from the dynamodb.

Is your Feature Request related to a problem?

You can't use immutable data classes and you have to use the norags plugin.

Describe alternatives you've considered

Use var's instead of val's and use norags plugin:

plugins{
   id("org.jetbrains.kotlin.plugin.noarg") version "1.4.10"
}
noArg {
  annotation("software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean")
}

Your Environment

  • AWS Java SDK version used: 2.15.7
  • JDK version used: 11
  • Operating System and version: Mac 10.15.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions