Skip to content
This repository was archived by the owner on Feb 8, 2022. It is now read-only.

Commit cd48ec6

Browse files
author
Florent Champigny
committed
updated README
1 parent 40f5ef7 commit cd48ec6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

navigator/src/main/java/com/github/florent37/navigator/Parameter.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,38 @@ import kotlin.reflect.KProperty
88

99
open class Parameter : Serializable
1010

11+
/**
12+
* Retrieve a non nullable route Parameter
13+
*
14+
* val args = routeParamValue<MyRoute.MyParam>
15+
*/
1116
fun <T> Activity.routeParamValue(): T {
1217
return this.intent.getSerializableExtra(ROUTE_ARGS_KEY) as T
1318
}
1419

20+
/**
21+
* Retrieve a non nullable flavor Parameter
22+
*
23+
* val args = flavorParamValue<MyRoute.MyParam>
24+
*/
1525
fun <T> Activity.flavorParamValue(): T {
1626
return this.intent.getSerializableExtra(ROUTE_FLAVOR_ARGS_KEY) as T
1727
}
1828

29+
/**
30+
* Retrieve a nullable route Parameter
31+
*
32+
* val args : MyRoute.MyParam? = optionalRouteParamValue<MyRoute.MyParam>
33+
*/
1934
fun <T> Activity.optionalRouteParamValue(): T? {
2035
return this.intent?.getSerializableExtra(ROUTE_ARGS_KEY) as? T
2136
}
2237

38+
/**
39+
* Retrieve a nullable flavor Parameter
40+
*
41+
* val args : MyRoute.MyParam? = optionalFlavorParamValue<MyRoute.MyParam>
42+
*/
2343
fun <T> Activity.optionalFlavorParamValue(): T? {
2444
return this.intent?.getSerializableExtra(ROUTE_FLAVOR_ARGS_KEY) as? T
2545
}

0 commit comments

Comments
 (0)