Merged
Conversation
- Added new annotation which can only on a field or property of type
Integer or int
- Only one such field can exist per class
- On read, mapped the generation value back to the field
- On write, if the field is set > 0, set the writePolicy.generation to
this value and writePolicy.generationPolicy to EXPECT_GEN_EQUAL
- Added appropriate configuration file
- Added code config: `.withFieldNamed("generation").asGenerationField()`
- Created unit tests for validation
- Updated the AeroMapperBaseTest class to honor `test.host` if set as a
system property instead of the default `localhost:3000`
src/main/java/com/aerospike/mapper/annotations/AerospikeGeneration.java
Outdated
Show resolved
Hide resolved
| Integer versionValue = entry.getGenerationValue(object); | ||
| if (versionValue != null && versionValue > 0) { | ||
| writePolicy.generation = versionValue; | ||
| writePolicy.generationPolicy = GenerationPolicy.EXPECT_GEN_EQUAL; |
There was a problem hiding this comment.
If for some reason, the class's write policy is set to GenerationPolicy.EXPECT_GEN_GT will we be overriding it?
Contributor
Author
There was a problem hiding this comment.
Yes. I have never found any reason to use EXPECT_GEN_GT, it makes no sense as generations wrap around.
Good catches on those couple of trailing references to version instead of generation!
|
@tim-aero @roimenashe Please merge this? |
Member
reugn
approved these changes
Jul 3, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves issue #181.
.withFieldNamed("generation").asGenerationField()test.hostif set as a system property instead of the defaultlocalhost:3000