I have a POJO as follows:
public class ClosureCodeReasonRequest {
@NotNull(message = MessageConstants.CLOSURE_CODE_BLANK_ERROR)
@NotBlank(message = MessageConstants.CLOSURE_CODE_BLANK_ERROR)
private String closureCode;
@NotNull(message = MessageConstants.REASON_TITLE_BLANK_ERROR)
@NotBlank(message = MessageConstants.REASON_TITLE_BLANK_ERROR)
@Size(max = 50, message = MessageConstants.REASON_TITLE_TOO_LONG)
private String reasonTitle;
@NotEmpty
private List<String> programList;
@NotNull
@NotBlank
private String isActive;
@NotNull
@NotBlank
private Long version;
}
In the above POJO, value of isActive
can be either "true" or "false" and length of programList
can be either 1 or 2 and contents will be among "Test1" and "Test2".
Is there any built in annotation that can be used for these requirements or do I have to create a new one?