I have a variable effectiveDate that is an API parameter:
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DATE_OR_DATE_AND_TIME_FORMAT)
@ApiModelProperty(value = "effectiveDate")
private Date effectiveDate = null;
The current value of DATE_OR_DATE_AND_TIME_FORMAT is "yyyy-MM-dd HH:mm:ss". But I need to be able to accept "yyyy-MM-dd HH:mm:ss" OR "yyyy-MM-dd". I was doing this with a Regex pattern before, because this was a String, not a Date, but it can no longer be a string and must be a Date. Is there a way to make pattern have several values, or something like an or statement in a pattern?