我习惯于使用验证规则来检查我的其余参数:
public class ConfigurationParameterForm {
private @NotEmpty String name;
private @NotNull Object value;
private @NotEmpty String beanProperty;
private @NotEmpty String type;
}
type
字段必须为以下枚举值之一:
public enum ParameterType {
A("API"), B("BackOffice"), F("FrontOffice"), Q("Quartz"), S("Servlet");
private String description;
ParameterType(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
因此,我想检查type
仅包含有效值,我的意思是A
,B
,F
,Q
,{{ 1}}。
有什么想法吗?