Skip to content

Enhanced DynamoDB annotations are incompatible with Lombok #1932

Open
@bill-phast

Description

@bill-phast

Describe the Feature

Lombok is a popular system for reducing boilerplate code, especially in data-centric objects such as database entries. By annotating the class and/or member variables, it autogenerates setters and getters. This creates problems with enhanced dynamodb, because the annotations such as DynamoDbAttribute and DynamoDbPartitionKey cannot be applied to member variables, only to setter/getter functions, and the setter/getter function is not present in the source code. In DynamoDbMapper (from AWS SDK v1), annotations could be applied to functions or member variables, so Lombok worked well. It would be great if the enhanced DynamoDb library could work the same way.

Is your Feature Request related to a problem?

I'm always frustrated when I cannot use the new SDK because it is incompatible with other software that my development team depends on.

Proposed Solution

Ideally the annotations can be applied to member variables in the same manner that the SDKv1 dynamoDbMapper annotations could.
As a second-best alternative, it could allow the annotations to be applied to member variables, but ignore them; with a little work, Lombok can be set to copy annotations from member variables to the setters and getters.

Describe alternatives you've considered

The alternative is to write explicit setters and getters for all dynamo-annotation values. This would be a significant pain point, however; we will probably prefer to stay with SDKv1.

Additional Context

Lombok annotations are as follows:

@Setter
@Getter
public class Customer {
  private String id;

  private String email;

  private Instant registrationDate;
}

Functions "setId(String)", "getId()", etc. are all generated automatically, so there is no way to get the annotations onto them.

  • I may be able to implement this feature request

Your Environment

  • AWS Java SDK version used: 2.13.47
  • JDK version used: Java 11
  • Operating System and version: Ubuntu (on EC2), AWS Lambda (whatever version of Linux that is)

Metadata

Metadata

Assignees

No one assigned

    Labels

    dynamodb-enhancedfeature-requestA feature should be added or improved.p2This is a standard priority issuethird-partyThis issue is related to third-party libraries or applications.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions