You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 20, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -581,3 +581,33 @@ data class Src(
581
581
valparam2:Int
582
582
)
583
583
```
584
+
585
+
## Setting Up Arguments
586
+
587
+
### Target for argument reading
588
+
The `KMapper` can read the `public` field of an object, or the properties of `Pair<String, Any?>` and `Map<String, Any?>`.
589
+
590
+
### Setting Up Arguments
591
+
The `KMapper` performs the setup process if the value is not `null`.
592
+
In the setup process, first of all, `parameterClazz.isSuperclassOf(inputClazz)` is used to check if the input can be set as an argument or not, and if not, the conversion described later is performed and the result is used as an argument.
593
+
594
+
If the value is `null`, the `KParameterRequireNonNull` annotation is checked, and if it is set, the setup process is skipped, otherwise `null` is used as the argument.
595
+
596
+
If the `KUseDefaultArgument` annotation is set or all inputs are skipped by the `KParameterRequireNonNull` annotation, the default argument is used.
597
+
If the default argument is not available at this time, a runtime error occurs.
598
+
599
+
#### Conversion of arguments
600
+
`KMapper` performs conversion and checking in the following order.
601
+
602
+
**1. Checking the specification of the conversion process by annotation**
603
+
First of all, it checks for conversions specified by the `KConvertBy` and `KConverter` annotations for the class of the input.
604
+
605
+
**2. Confirmation of conversion to Enum**
606
+
If the input is a `String` and the argument is an `Enum`, the function tries to convert the input to an `Enum` with the corresponding `name`.
607
+
608
+
**3. Confirmation of conversion to string**
609
+
If the argument is `String`, the input will be `toString`.
610
+
611
+
**4. Conversion using the mapper class**
612
+
If the transformation does not meet the criteria so far, a mapping process is performed using a mapper class.
613
+
For this mapping process, `PlainKMapper` is used for `PlainKMapper`, and `BoundKMapper` is used for others.
0 commit comments