Annotation Interface OneOf
@Target({METHOD,FIELD,ANNOTATION_TYPE})
@Retention(RUNTIME)
@Constraint(validatedBy=OneOfValidator.class)
@Documented
public @interface OneOf
sample:
@Valid
@NotEmpty(message = "List should not be empty")
@OneOf(value = {"op1", "op2", "op3"}, message = "Only valid options are
accepted")
List<String> options;
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements