Skip to content

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
wants to merge 2 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Nov 26, 2020

We now provide a KPropertyPath 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.

Related ticket: DATACMNS-1835.

@mp911de
Copy link
Member Author

mp911de commented Nov 26, 2020

/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.
@mp911de mp911de force-pushed the issue/DATACMNS-1835 branch from 9233eab to 028e7db Compare November 27, 2020 07:56
import kotlin.reflect.KProperty

/**
* Extension for [KProperty] providing an `toPath` function to render a [KProperty] in dot notation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toDotPath function?

@sdeleuze
Copy link
Contributor

sdeleuze commented Dec 8, 2020

👍 for this PR.

@mp911de mp911de closed this Dec 31, 2020
@mp911de mp911de reopened this Dec 31, 2020
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 4, 2021
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 7, 2021
@mp911de mp911de assigned mp911de and christophstrobl and unassigned mp911de Jan 7, 2021
@christophstrobl christophstrobl linked an issue Jan 12, 2021 that may be closed by this pull request
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
@christophstrobl christophstrobl deleted the issue/DATACMNS-1835 branch January 12, 2021 13:05
@christophstrobl christophstrobl added this to the 2.5 M2 (2021.0.0) milestone Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide Type-safe Kotlin query extension [DATACMNS-1835]
4 participants