Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit 8df7360

Browse files
committed
デフォルト値の利用について追記
1 parent 9424d5f commit 8df7360

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,31 @@ class LocalDateTimeDeserializerImpl(
220220
}
221221
```
222222

223+
### Use default arguments
224+
`KRowMapper` supports `default arguments`.
225+
`Default arguments` are available in the following situations:
226+
227+
- When not referring to the acquisition result
228+
- When the acquisition result is `null`
229+
230+
As of `KRowMapper` 0.8, it does not support the use of `default argument` when columns cannot be obtained.
231+
232+
#### When not referring to the acquisition result
233+
When the `KUseDefaultArgument` `annotation` is added to the parameter,
234+
the `default argument` can be used forcibly without referring to the obtained result.
235+
236+
```kotlin
237+
data class Dst(val fooId: Int, @param:KUseDefaultArgument val barValue: String = "default")
238+
```
239+
240+
#### When the acquisition result is null
241+
When `KParameterRequireNonNull` `annotation` is given to a parameter,
242+
the default argument can be used if the obtained result is `null`.
243+
244+
```kotlin
245+
data class Dst(val fooId: Int, @param:KParameterRequireNonNull val barValue: String = "default")
246+
```
247+
223248
## Installation
224249
Published on JitPack.
225250
You can use this library on `maven`, `gradle` and any other build tools.

0 commit comments

Comments
 (0)