Jan Gerritsen
01/07/2022, 2:22 PMclass Test(
@field:Valid
val inlinedMember: InlinedMember,
@field:Valid
val normalMember: NormalMember,
)
@JvmInline
value class InlinedMember constructor(
@field:NotBlank
val subAttr: String
)
class NormalMember constructor(
@field:NotBlank
val subAttr: String
)
After I compile this code and run it, the property inlinedMember of the class Test is replaces with the type String and the annotation @field:NotBlank is lost, resulting in the validator not validating this constrain.
Has anyone an idea how to keep the information (without copying it) or what else to do?
The goal is to use the same value class (e.g. email, bithdate, username,..) at several places and only define the constrains once.
This is a spring boot project, using jackson to parse and validate the JSON data on the REST controllerJan Gerritsen
01/07/2022, 4:24 PM