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

Add path method for KFunction1 #521

Merged
merged 9 commits into from
Nov 12, 2023
Prev Previous commit
Next Next commit
docs: fix grammar
jbl428 committed Nov 12, 2023
commit 04cef12815409ec1476d225af685c864b53c03c7
6 changes: 3 additions & 3 deletions docs/en/jpql-with-kotlin-jdsl/paths.md
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ entity(Book::class, "b")(Book::isbn)(Isbn::value)

## Java entity

`path()` and `invoke()` take `KProperty1` or `KFuction1` as an argument.
`path()` and `invoke()` can take `KProperty1` or `KFuction1` as an argument.
`KFunction1` is useful when you use Java entity with private property and public getter.

```java
@@ -40,7 +40,7 @@ path(Book::title)
path(Book::getTitle)
```

Kotlin JDSL follows the following rules to infer property name from getter name.
Kotlin JDSL infers the property name from the getter with the following rules:

- If the name starts with `is`, use the name as it is.
- If the name starts with `get`, remove `get` and change the first letter to lowercase.
@@ -54,7 +54,7 @@ path(Book::isAvailable)
path(Book::getAvailable)
```

If you want to use your own rule instead of the above rules, you need to implement `JpqlPropertyIntrospector` and provide it to `RenderContext`.
If you want to use your own rule instead of the above rules, you can implement `JpqlPropertyIntrospector` and provide it to `RenderContext`.

```kotlin
class MyIntrospector : JpqlPropertyIntrospector() {