java
共 1 篇文章
使用反射读取enum的属性
使用到的Enum如下: public enum Colour{ RED(113001, "红色"), BLUE(113002, "蓝色"); private int code; private String name; Colour(int code,String name){ this.code= code; this.name= name; } public String toName() { return this.name == null ? this.name() : this.name; } public int toCode() { return this.code == nu…
2012-09-13 20:28 · java