maxpilotto/krand

Default values for properties instead of using null

Closed this issue · 0 comments

It should be possible to define a default value for the automatically generated generators

// No default parameters
@Generator("integer", Int::class)
interface _IntegerGenerator {
    val min: Int
    val max: Int
}

// With default parameters
@Generator("integer", Int::class)
abstract class _IntegerGenerator {    // "abstract class" is required since interfaces can't have property initializers
    val min: Int = Int.MIN_VALUE
    val max: Int = Int.MAX_VALUE
}