kango_v
07/20/2018, 1:30 PMclass Test (
val id: UUID
) {
private constructor(builder: Builder) : this(builder.id)
companion object {
inline fun build(id: UUID, block: Builder.() -> Unit) = Builder(id). apply(block).build()
}
class Builder(
val id: UUID) {
var text: String? = null
fun build() = Test(this)
}
}
but, at apply
, i'm getting Unresolved reference: apply
. I am using the Eclipse Kotlin plugin. I know, I should be using IDEA....... one step at a time. 🙂Andreas Sinz
07/20/2018, 1:46 PMkango_v
07/20/2018, 2:00 PMpom.xml
or build.gradle
?kango_v
07/20/2018, 2:03 PMbuild.gradle
file as compileOnly
and it works 🙂 But, do you need this at run time as well?Andreas Sinz
07/20/2018, 2:31 PMkango_v
07/20/2018, 4:05 PMkarelpeeters
07/20/2018, 4:42 PMapply
you might be fine without it, since it's inline
.