I don't believe you can use the "OR" logic explicitly on a given attribute. However, if you are using the 4.2.0.Beta2 release, you can "compose" a custom constraint which will take either.
Hardy's blog post at
http://in.relation.to/18074.lace demonstrates the creation of a "PatternOrSize" constraint. The example code taken from the blogpost is as follows:
Code:
@ConstraintComposition(OR)
@Pattern(regexp = "K")
@Size(min = 2, max = 10)
@ReportAsSingleViolation
@Target({ METHOD, FIELD })
@Retention(RUNTIME)
@Constraint(validatedBy = { })
public @interface PatternOrSize {
public abstract String message() default "OR";
public abstract Class<?>[] groups() default { };
public abstract Class<? extends Payload>[] payload() default { };
}
Using a similar concept, you should be able to fairly easily compose your own EmailOrMobilePhone constraint.
JRN