@FooValidator
public class Foo
{
@NotNull
private String value;
private String property;
}
/*
* Validate that property is only valid if value equals "test"
*/
public class FooValidator
{
@Override
public boolean isValid(final Foo foo, final ConstraintValidatorContext context)
{
if (!value.equals("test") && property != null)
return false;
}
}