I read a code generated by khipster and in one dataclass I found such fragment:
import javax.validation.constraints.NotNull
data class MyDTO(
var id: Long? = null,
@get: NotNull
var name: String? = null,
What does @get:NotNull
annotation mean? As far as I understand @get
means that I want to annotate the getter of name
property and NotNull
is a validation annotation which mean that the thing can't be set to null. But how the two work together? It doesn't make any sense to annotate getter with annotation which means this can't be set to null, because getter can't be set. It would make more sens to use NotNull
annotation on setter.