java - Bean Validation with args condition -
let's assume situation.
i have length
label. want show me message length must lower 5!
, other time should show length must value between 2 , 5!
. should depend on number of arguments pass this.
could done without using second label, instance length
?
it can done without different values in property file.
for e.g. have label such:
my.label=length must lower 5!,length must value between 2 , 5!
but not recommended. need split based on separator, comma in case, , handle logic yourself.
the clean solution be:
my.label.error.maxsize=length must lower 5! my.label.error.size=length must between 2 , 5!
and of course value maxsize or size can set programatically.
edit:
the java implementation depends lot on framework used load values property files.
Comments
Post a Comment