Mon Aug 10, 2009 2:09 pm
@XmlType(name = "yes_no")
@XmlEnum
public enum YesNo {
@XmlEnumValue("yes")
YES("yes"),
@XmlEnumValue("no")
NO("no");
private final String value;
YesNo(String v) {
value = v;
}
public String value() {
return value;
}
public static YesNo fromValue(String v) {
for (YesNo c: YesNo.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
Tue Aug 11, 2009 11:35 am
String str = YesNo .YES.value();
System.out.println("The vaue of enum is "+str);
The vaue of enum is yes
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.