Add field-level amount representation for Joda-Money (@JodaMoney annotation) by sri-adarsh-kumar · Pull Request #76 · FasterXML/jackson-datatypes-misc (original) (raw)
and others added 4 commits
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
Co-Authored-By: Claude noreply@anthropic.com
…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
Co-Authored-By: Claude noreply@anthropic.com
- 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
Co-Authored-By: Claude noreply@anthropic.com
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
Co-Authored-By: Claude noreply@anthropic.com
cowtowncoder changed the title
Add field-level amount representation for Joda-Money Add field-level amount representation for Joda-Money (@JodaMoney annotation)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})