I have a class with two attributes. I want to use Java Bean Validation but ran with one problem on how to approach?
class ProductRequest {
private String quantityType;
private double quantityValue;
//getters and setters
}
I want to use Java Bean Validation based on below condition. If "quantityType" is equals to "foo", limit "quantityValue" to maximum size of 5 else "quantityType" is equals to "bar", limit "quantityValue" to maximum size of 3.
What will be the best way to approach in this scenario?