@@ -305,14 +305,26 @@ val Mutant.doubleValue: Double
305305val Mutant .value: String
306306 get() = value()
307307
308+ inline fun <reified T > Mutant.to (): T {
309+ return this .to(T ::class .java)
310+ }
311+
308312fun <T : Any > Mutant.to (type : KClass <T >): T {
309313 return this .to(type.java)
310314}
311315
316+ inline fun <reified T > Mutant.to (contentType : MediaType ): T {
317+ return this .to(T ::class .java, contentType)
318+ }
319+
312320fun <T : Any > Mutant.to (type : KClass <T >, contentType : MediaType ): T {
313321 return this .to(type.java, contentType)
314322}
315323
324+ inline fun <reified T > Mutant.to (contentType : String ): T {
325+ return this .to(T ::class .java, contentType)
326+ }
327+
316328fun <T : Any > Mutant.to (type : KClass <T >, contentType : String ): T {
317329 return this .to(type.java, contentType)
318330}
@@ -341,3 +353,15 @@ fun <T:Comparable<T>> Mutant.toSortedSet(type: KClass<T>): SortedSet<T> {
341353fun <T : Any > Request.set (type : KClass <T >, value : Any ): Request {
342354 return this .set(type.java, value)
343355}
356+
357+ inline fun <reified T > Request.param (name : String ): T {
358+ return param(name).to(T ::class .java)
359+ }
360+
361+ inline fun <reified T > Request.header (name : String ): T {
362+ return param(name).to(T ::class .java)
363+ }
364+
365+ inline fun <reified T > Request.body (): T {
366+ return body().to(T ::class .java)
367+ }
0 commit comments