org.zodiac.script.expression.api.ModalExpression Maven / Gradle / Ivy
package org.zodiac.script.expression.api;
public interface ModalExpression extends Expression {
default String getName() {
Modality mod = getModality();
return null != mod ? mod.getName() : null;
}
Modality getModality();
public static interface MustExpression extends ModalExpression {
default Modality getModality() {
return Modality.MUST;
}
}
public static interface MustNotExpression extends ModalExpression {
default Modality getModality() {
return Modality.MUST_NOT;
}
}
public static interface ShouldExpression extends ModalExpression {
default Modality getModality() {
return Modality.SHOULD;
}
}
public static interface ShouldNotExpression extends ModalExpression {
default Modality getModality() {
return Modality.SHOULD_NOT;
}
}
public static enum Modality {
MUST("must"),
MUST_NOT("mustNot"),
SHOULD("should"),
SHOULD_NOT("shouldNot"),
;
private String name;
private Modality(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
}