40 lines
961 B
Java
40 lines
961 B
Java
package net.gepafin.tendermanagement.enums;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonValue;
|
|
|
|
|
|
public enum MatchModeEnum {
|
|
STARTSWITH("starts with"),
|
|
ENDSWITH("ends with"),
|
|
CONTAINS("contains"),
|
|
EQUALS("equals"),
|
|
DATEIS("date is"),
|
|
DATEISNOT("date is not"),
|
|
BEFORE("date is before"),
|
|
AFTER("date is after");
|
|
|
|
private String value;
|
|
|
|
MatchModeEnum(String value) {
|
|
this.value = value;
|
|
}
|
|
public static MatchModeEnum fromObject(Object value) {
|
|
if (value instanceof String) {
|
|
String strValue = ((String) value).trim();
|
|
for (MatchModeEnum mode : MatchModeEnum.values()) {
|
|
if (mode.getValue().equalsIgnoreCase(strValue)) {
|
|
return mode;
|
|
}
|
|
}
|
|
}
|
|
throw new IllegalArgumentException("Invalid MatchModeEnum: " + value);
|
|
}
|
|
|
|
|
|
|
|
@JsonValue
|
|
public String getValue() {
|
|
return value;
|
|
}
|
|
}
|