Support DynamoDbConvertedBy annotation on type
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 51
Description
### Describe the feature
Currently, `@DynamoDbConvertedBy` can be applied only to a property method. I would like to be able to apply it to a Java type, similar to Jackson `@JsonSerialize(using = Some.class)` and have it registered as a default.
### Use Case
I have a value type that I would like to be storable as a formatted string. Currently, for custom conversion I must either (create and) annotate every property getter that uses this value type with `@DynamoDbConvertedBy` or annotate every class that uses this type as a property with an `AttributeConverterProvider`. Instead, I would like to be able to say _on the converted type_ "use this converter globally".
### Proposed Solution
Allow `@DynamoDbConvertedBy` to target `TYPE`.
In `DefaultAttributeConverterProvider#findConverterInternal`, before checking `if (type.tableSchema().isPresent())`, check whether the `rawClass` has the `@DynamoDbConvertedBy` annotation. If it does, use that converter and skip the schema check.
### Other Information
_No response_
### Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### AWS Java SDK version used
2.19.25
### JDK version used
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
### Operating System and version
Gentoo Linux
Contributor guide
Assessment
This issue has not been assessed yet.