-
Notifications
You must be signed in to change notification settings - Fork 14
Implement AerospikeGeneration annotation #182
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If for some reason, the class's write policy is set to GenerationPolicy.EXPECT_GEN_GT will we be overriding it?
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.
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? |
Resolves issue #181.
.withFieldNamed("generation").asGenerationField()
test.host
if set as a system property instead of the defaultlocalhost:3000