Description
Describe the feature
For classes that for whatever reason cannot carry Jackson annotations directly, Jackson supports defining a "mixin" interface that mirrors the properties of the class and has the desired annotations. It would be helpful if the Enhanced client had a similar capability.
Use Case
I have a number of data classes that are defined in client or API dependencies (for example, for message-driven microservices that communicate over SNS/SQS). In particular, I have one domain value class that is a nested property on a top-level record class. If I want to use TableSchema.fromClass(RecordClass)
, then NestedClass
also has to carry the @DynamoDbBean
annotation, but then I have to add otherwise-unnecessary DynamoDB dependencies the client library (even if optional
).
Proposed Solution
Add annotation @DynamoDbMixin(value = Class<?>)
with target TYPE
. Extend TableSchema.fromClass(Class)
to also accept Class<?> mixins...
, where if a type whose schema is being created has a provided mixin, the mixin is introspected to determine the properties to be mapped. The mixin should be checked only for property enumeration and should not require the presence of setters.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS Java SDK version used
2.21.25
JDK version used
openjdk version "11.0.11" 2021-04-20
Operating System and version
Gentoo Linux