Skip to content

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

Merged
merged 4 commits into from
Jul 3, 2025
Merged

Conversation

tim-aero
Copy link
Contributor

@tim-aero tim-aero commented Jun 10, 2025

Resolves issue #181.

  • 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

- 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`
@tim-aero tim-aero requested a review from roimenashe June 10, 2025 03:32
Integer versionValue = entry.getGenerationValue(object);
if (versionValue != null && versionValue > 0) {
writePolicy.generation = versionValue;
writePolicy.generationPolicy = GenerationPolicy.EXPECT_GEN_EQUAL;

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?

Copy link
Contributor Author

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!

@51stDimension
Copy link

@tim-aero @roimenashe Please merge this?

@roimenashe
Copy link
Member

@roimenashe roimenashe requested a review from reugn July 2, 2025 09:34
@reugn reugn changed the title Implemented @AerospikeGeneration (Issue #181) Implement AerospikeGeneration annotation Jul 3, 2025
@reugn reugn merged commit 0f4f717 into main Jul 3, 2025
9 checks passed
@reugn reugn deleted the version-control-support branch July 3, 2025 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants