Skip to content
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

Code cleanup: UnitOfWorkInvoker and UnitOfWorkInvokerFactory #98

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

sleberknight
Copy link
Member

  • Update obsolete javadoc comment in UnitOfWorkInvoker. Dropwizard made UnitOfWorkAspect public a long time ago, in version 1.1.0.
  • Modify UnitOfWorkInvoker#invoke to use try-with-resources for the Hibernate Session, and wrap the Map#get call with requireNonNull since the containsKey check returned true. Remove redundant RuntimeException type parameter in call to rethrow.
  • Use var in UnitOfWorkInvokerFactory for the ImmutableMap.Builder to reduce code verbosity
  • Refactor logic in UnitOfWorkInvokerFactory so that it doesn't reassign a local variable. Instead, if the "unitOfWorkMethods" map is empty, return the rootInvoker. This inverts the logic and is clearer, since re-assigning variables is generally not a good practice.

* Update obsolete javadoc comment in UnitOfWorkInvoker. Dropwizard
  made UnitOfWorkAspect public a long time ago, in version 1.1.0.
* Modify UnitOfWorkInvoker#invoke to use try-with-resources for
  the Hibernate Session, and wrap the Map#get call with requireNonNull
  since the containsKey check returned true. Remove redundant
  RuntimeException type parameter in call to rethrow.
* Use var in UnitOfWorkInvokerFactory for the ImmutableMap.Builder
  to reduce code verbosity
* Refactor logic in UnitOfWorkInvokerFactory so that it doesn't
  reassign a local variable. Instead, if the "unitOfWorkMethods"
  map is empty, return the rootInvoker. This inverts the logic
  and is clearer, since re-assigning variables is generally
  not a good practice.
@sleberknight sleberknight added the code cleanup Fix issues reported by Sonar or any other code analysis tools label Feb 8, 2024
@sleberknight sleberknight added this to the 0.10.0 milestone Feb 8, 2024
@sleberknight sleberknight self-assigned this Feb 8, 2024
Copy link

sonarcloud bot commented Feb 8, 2024

@sleberknight sleberknight merged commit 0944487 into main Feb 8, 2024
5 checks passed
@sleberknight sleberknight deleted the code-cleanup-unit-of-work-invoker-annd-factory branch February 8, 2024 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Fix issues reported by Sonar or any other code analysis tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant