https://kotlinlang.org logo
#announcements
Title
# announcements
s

snowe

01/13/2017, 6:04 PM
is there any way to avoid setting
Int
as
-1
or
?
in this situation?
Copy code
class Builder() {
        var appraiserId: Int = -1   // lateinit can not used for primitive type
        fun appraiserId(v: Int) = apply { appraiserId = v }


        fun build(): AppraisalOrderRequest {
            assertArgumentNotEquals(this.appraiserId, -1, "The appraiserId must not be set.")

            return AppraisalOrderRequest(
                    this.appraiserId)
        }

    }