开发者

JSR-303 validation using an OR relationship

I have a field in my bean that I would like to be either Null, OR a date in the past. JSR-303 provides annotations for Null and Past, but if I apply both the it will never validate because it can't be both Null and Past. I would like to combine the validations in an OR relationship. I'm pretty sure I'll have to create my own v开发者_如何学JAVAalidator implementation for that, but I'm hoping I'm missing something and one of you can show me how to easily combine the existing validators in an OR relationship.


All of the default JSR-303 annotations allow Null through. (Except, obviously, NotNull!) Simply using @Past is implicitly "in the past, or null."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜