blob: d8165082b1bcfe6fc21134b3020b7f4c735bc507 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
Parameters
==========
Declare parameters on methods and constructors with either `ParameterSpec.builder()` or
`FunSpec`'s convenient `addParameter()` API:
```kotlin
val android = ParameterSpec.builder("android", String::class)
.defaultValue("\"pie\"")
.build()
val welcomeOverlords = FunSpec.builder("welcomeOverlords")
.addParameter(android)
.addParameter("robot", String::class)
.build()
```
The code above generates:
```kotlin
fun welcomeOverlords(android: String = "pie", robot: String) {
}
```
The extended `Builder` form is necessary when the parameter has annotations (such as `@Inject`).
|