[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: enums, generics and other animals
adrian@jboss.org
do-not-reply at jboss.com
Fri Mar 7 09:15:29 EST 2008
"alesj" wrote : Another refactoring question. :-)
| Since for xml handling I still need to get the right enum by matching the underlying strings.
| The thing is that on enums there is already a valueOf method which does similar thing, matching enum's name with input string parameter.
| But in our case the names do not match exactly the underlying strings, resulting in needing something like getInstance method which iterates over the enums and does a string match.
| Should I just use the valueOf and fix the strings in our tests?
| Probably not, since it will break quite some things. :-)
RTFM :-)
You can actually do some pretty weird stuff, so don't overuse it ;-)
| @XmlEnum(Integer.class)
| public enum OldEnglishMoney
| {
| @XmlEnumValue("D")
| PENNY(1),
| @XmlEnumValue("S")
| SHILLING(12)
| @XmlEnumValue("L")
| POUND(240)
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4134855#4134855
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4134855
More information about the jboss-dev-forums
mailing list