-
Notifications
You must be signed in to change notification settings - Fork 682
DATACMNS-1835 - Provide Type-safe Kotlin query extension #478
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
Closed
Conversation
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
/cc @sdeleuze |
We now provide a KProperty extension leveraging KProperty references to express a property path. Using Kotlin property references (such as Author::name that translates to `book` or Book::author / Author.name translating to `book.author`) is refactoring-safe as the property expressions are part of the Kotlin language. We render KPropertyPath using the same semantics as our PropertyPath so that store-specific modules can leverage either property paths or accept KProperty directly. In contrast to the previous implementation, KPropertyPath is private and the rendering function was renamed to toDotPath to align with PropertyPath.toDotPath. Related ticket: DATAMONGO-2138.
9233eab
to
028e7db
Compare
sdeleuze
reviewed
Dec 8, 2020
import kotlin.reflect.KProperty | ||
|
||
/** | ||
* Extension for [KProperty] providing an `toPath` function to render a [KProperty] in dot notation. |
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.
toDotPath
function?
👍 for this PR. |
christophstrobl
pushed a commit
that referenced
this pull request
Jan 12, 2021
We now provide a KProperty extension leveraging KProperty references to express a property path. Using Kotlin property references (such as Author::name that translates to `book` or Book::author / Author.name translating to `book.author`) is refactoring-safe as the property expressions are part of the Kotlin language. We render KPropertyPath using the same semantics as our PropertyPath so that store-specific modules can leverage either property paths or accept KProperty directly. In contrast to the previous implementation, KPropertyPath is private and the rendering function was renamed to toDotPath to align with PropertyPath.toDotPath. Related ticket: DATAMONGO-2138 (spring-projects/spring-data-mongodb#3515) Original Pull Request: #478 Closes: #2250
christophstrobl
added a commit
to spring-projects/spring-data-mongodb
that referenced
this pull request
Jan 12, 2021
relates to: spring-projects/spring-data-commons#478 Original Pull Request: #3533 Closes: #3515
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.
We now provide a
KPropertyPath
extension leveragingKProperty
references to express a property path. Using Kotlin property references (such asAuthor::name
that translates tobook
orBook::author / Author.name
translating tobook.author
) is refactoring-safe as the property expressions are part of the Kotlin language. We renderKPropertyPath
using the same semantics as ourPropertyPath
so that store-specific modules can leverage either property paths or acceptKProperty
directly.Related ticket: DATACMNS-1835.