-
Couldn't load subscription status.
- Fork 23
Add field-level amount representation for Joda-Money (@JodaMoney annotation)
#76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add field-level amount representation for Joda-Money (@JodaMoney annotation)
#76
Conversation
Implements per-property override of amount representation to complement the module-level default introduced in PR FasterXML#17. Changes: - Add DEFAULT value to AmountRepresentation enum to represent "inherit module config" - Add @jsonmoney annotation for field-level configuration - Make MoneySerializer and MoneyDeserializer contextual to support per-property resolution - Support @jsonformat(shape=...) mapping: STRING→DECIMAL_STRING, NUMBER/NUMBER_FLOAT→DECIMAL_NUMBER, NUMBER_INT→MINOR_CURRENCY_UNIT - Precedence: @jsonmoney > @jsonformat > module default > built-in default - Full mix-in support via Jackson's standard BeanProperty API - Maintain backward compatibility for unannotated fields Tests: - Add MoneyFieldLevelRepresentationTest with 12 tests covering field/getter/constructor annotations, mixed configurations, precedence, and mix-ins - Add MoneyFormatShapeMappingTest with 9 tests covering shape mappings and multiple fields - All 94 tests pass (21 new, 73 existing with no regression) Fixes FasterXML#18 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…field-level-amount-representation
- Update package structure from com.fasterxml.jackson to tools.jackson - Adapt MoneySerializer for Jackson 3.x API (SerializationContext, JacksonException) - Adapt MoneyDeserializer for Jackson 3.x API - Update JsonMoney annotation package - Update test files package declarations and imports - Maintain field-level amount representation feature compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Fix Jackson 3.x API compatibility: use MapperBuilder.addMixIn() instead of ObjectMapper.addMixIn() - Replace AssertJ assertions with JUnit assertions (assertTrue, assertEquals) - Fix import statements to use correct Jackson 3.x package names - Update MoneySerializer and MoneyDeserializer to implement contextual serialization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
joda-money/src/main/java/tools/jackson/datatype/jodamoney/MoneyDeserializer.java
Outdated
Show resolved
Hide resolved
joda-money/src/main/java/tools/jackson/datatype/jodamoney/JsonMoney.java
Outdated
Show resolved
Hide resolved
joda-money/src/main/java/tools/jackson/datatype/jodamoney/MoneyDeserializer.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable; couple of changes needed but nothing major. Can go in 3.1.0 (API addition with new enum type).
|
@sri-adarsh-kumar we have CCLA for Zalando so you would be covered, right? If so, no need for individual CLA. |
Renamed the @jsonmoney annotation to @JodaMoney for better alignment with the module naming convention. This change updates: - Annotation interface name from JsonMoney to JodaMoney - All references in serializer and deserializer classes - All test cases and documentation examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Looks good, will try to do proper review soon, to merge in 3.x for 3.1.0 |
joda-money/src/main/java/tools/jackson/datatype/jodamoney/AmountRepresentation.java
Show resolved
Hide resolved
| * | ||
| * @see AmountRepresentation | ||
| * @see JodaMoneyModule#withAmountRepresentation(AmountRepresentation) | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SInCE 3.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- I can add missing @since annotations.
@JodaMoney annotation)
Implements per-property override of amount representation to complement the module-level default introduced in PR #17.
Changes:
Tests:
Fixes #18
🤖 Generated with Claude Code