@Documented @Constraint(validatedBy=CountryValidator.class) @Target(value={METHOD,FIELD,PARAMETER}) @Retention(value=RUNTIME) public @interface CountryConstraint
It will validate true for null, empty or blank values to bypass validation when the field is optional. If you require a country code to be mandatory, combine this constraint with @NotBlank.
for implementation details