main.kotlin.ch.tutteli.atrium.logic.utils.VarArgHelper.kt Maven / Gradle / Ivy
package ch.tutteli.atrium.logic.utils
import ch.tutteli.kbox.glue
/**
* Represents a parameter object used to express the arguments `T, vararg T`
* and provides utility functions to transform them.
*/
interface VarArgHelper {
/**
* The first argument in the argument list `T, vararg T`
*/
val expected: T
/**
* The second argument in the argument list `T, vararg T`
*/
val otherExpected: Array
/**
* Creates an [ArgumentMapperBuilder] which allows to map [expected] and [otherExpected].
*/
val mapArguments: ArgumentMapperBuilder
get() = ArgumentMapperBuilder(expected, otherExpected)
/**
* Returns the arguments as [List].
*/
fun toList(): List = expected glue otherExpected
}