-
Sub-task
-
Resolution: Unresolved
-
Major
-
2.1.1.Final
An existing constraint can have several implementations of different types. The following commands will create two implementations of the Max constraints: one for type Number and one for String :
constraint-new-validator --named MaxValidatorForNumber --type Number --targetConstraint Max constraint-new-validator --named MaxValidatorForString --type String --targetConstraint Max
The generated code would look like this for Number :
public class MaxValidatorForString implements ConstraintValidator<Max, Number> { @Override public void initialize(Max constraint) { } @Override public boolean isValid(Number value, ConstraintValidatorContext context) { return false; } }
And like that for String :
public class MaxValidatorForString implements ConstraintValidator<Max, String> { @Override public void initialize(Max constraint) { } @Override public boolean isValid(String value, ConstraintValidatorContext context) { return false; } }