DATAJDBC-218 - Add support for key column in @Column annotation#83
Closed
florianluediger wants to merge 2 commits intospring-projects:masterfrom
florianluediger:master
Closed
DATAJDBC-218 - Add support for key column in @Column annotation#83florianluediger wants to merge 2 commits intospring-projects:masterfrom florianluediger:master
florianluediger wants to merge 2 commits intospring-projects:masterfrom
florianluediger:master
Conversation
kedev
reviewed
Sep 1, 2018
|
|
||
| this.context = context; | ||
| this.columnName = Lazy.of(() -> Optional.ofNullable(findAnnotation(Column.class)).map(Column::value)); | ||
| this.keyColumnName = Lazy.of(() -> Optional.ofNullable(findAnnotation(Column.class)).map(Column::keyColumn)); |
There was a problem hiding this comment.
Since the default value for the keyColumn field is "", wouldn't you want to filter that out? Perhaps something like:
...map(Column::keyColumn).filter(x -> x != null && !x.equals(""))
Contributor
Author
There was a problem hiding this comment.
You were right, filtering out the default value is important here, I have added that.
Why are you also checking x for being not null, that case can not come up if I'm not mistaken.
There was a problem hiding this comment.
Yes, that's my bad. Forgot that null isn't an allowable value for annotations. It's been a while since I've written a custom annotation processor :)
schauder
added a commit
that referenced
this pull request
Sep 18, 2018
Added line breaks for better readability.
Added braces to if/else statements.
Used StringUtils instead of .equals("").
Original pull request: #83.
schauder
added a commit
that referenced
this pull request
Sep 18, 2018
Also: Added documentation for the new behavior. Made the value of the column annotation optional by providing a default. Original pull request: #83.
Contributor
|
Thanks, that is polished and merged. |
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.
This adds the functionality requested in DATAJDBC-218, so you can now customize the key column name for List and Map collections inside the @column annotation.
I have also added a test case to demonstrate the behavior.