aws / aws/aws-lambda-java-libs

How about some Builders in lambda-java-events

未关闭
#566 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
548
派生
241
平均合并
2 天 5 分钟
30 天内合并 PR
11

描述

The core AWS Java/Kotlin libraries provide builders for just about every object. Builders abound! In the `aws-lambda-java-events` library we get sad old POJOs.

```Kotlin
val messageAttribute = SQSEvent.MessageAttribute()
messageAttribute.stringValue = "So Verbose!"

val sqsMessage = SQSEvent.SQSMessage()
sqsMessage.body = objectMapper.writeValueAsString(DummyMessage(name = "Bob"))
sqsMessage.messageAttributes["So-Much-Typing"] = messageAttribute // <<-- whoops, error, messageAttributes is null
```

I guess I could do this, but its not winning any awards:
```Kotlin
val messageAttribute = SQSEvent.MessageAttribute()
messageAttribute.stringValue = "Still have to do this on two lines"

val sqsMessage = SQSEvent.SQSMessage()
sqsMessage.body = objectMapper.writeValueAsString(DummyMessage(name = "Bob"))
sqsMessage.messageAttributes = mapOf("So-Much-Typing" to messageAttribute)
```

I'm using `SQSEvent` as an example because that's what I was working with today. But same goes for `SNSEvent`, `S3Event`, `ScheduleEvent`, `LexEvent`...

I see that `KafkaEvent` uses Lombok. I'd take that.

Thanks.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。