I want to turn off javax.validation.constraints.Pattern for certain conditions.
It is used in field address.postcode to validate postcode pattern. But when address is non-uk then this should be turned off. We can know whether it is non-uk postcode by knowing where 'address' object is being used or at the place where postcode is being set.
@Pattern(regexp = 'some pattern',
message = "Postcode invalid")
@Column(nullable = true, length = 8)
private String postcode;