一.定义自定义注解
@Retention(RetentionPolicy.RUNTIME)//什么时候使用该注解,这里定义为运行时
@Target(ElementType.FIELD)//注解用于什么地方,这里定义为作用于属性上
public @interface Dict {
//字典类型,必需(创建字典时的key值)
String key();
//默认值,可选,值为null时使用默认值
String defaultValue() default "";
// OperateType operateType() default OperateType.ADD;
// public static enum OperateType {
// ADD("ADD", "1"),
// UPDATE("UPDATE", "2"),
// DELETE("DELETE", "3");
//
// private String name;
// private String index;
//
// private OperateType(String name, String index) {
// this.name = name;
// this.index = index;
// }
//
// public String getIndex() {
// return this.index;
// }
//
// public String getName() {
// return this.name;
// }
// }
}
---------------------------------------------------------