Fix: Add support for List<Integer> and other primitive wrapper lists #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4 - Mapper generation now correctly handles
List<Integer>
,List<Double>
, and other primitive wrapper lists.Problem
The annotation processor was failing to generate valid mapper code when encountering
List<Integer>
fields, attempting to use a non-existentListMapper
class and causing compilation errors.Root Cause
The
TypeAnalyzer
lacked a mapping strategy for lists of primitive wrapper types. It only handled:List<String>
→ STRING_LISTList<List<Number>>
→ NESTED_NUMBER_LISTList<@DynamoMappable>
→ COMPLEX_LISTLists of primitive wrappers fell through to COMPLEX_OBJECT, which incorrectly tried to generate mapper dependencies.
Solution
Core Changes
Added NUMBER_LIST mapping strategy (
FieldInfo.java
)Enhanced type detection (
TypeAnalyzer.java
)Implemented code generation (
FieldMappingCodeGenerator.java
)List<Integer>
to DynamoDB list format (L) with number attributes (N)Test Coverage
Added comprehensive integration tests (
ListIntegerMappingTest.java
):Generated Code Example
Before (compilation error):
After (working):
Test Results
All 27 integration tests pass, including 4 new tests for List mapping.