[jboss-dev-forums] [Design of JBossXB] - Re: Extending EnumValueAdapter

adrian@jboss.org do-not-reply at jboss.com
Tue Mar 18 10:12:02 EDT 2008


"alesj" wrote : 
  | Claiming constant 'not understanding' won't make your semi-detailed answers go away. :-)
  | 

They're semi-detailed because I'm saying your doing it wrong,
I want you try to understand how it really works (code - all of it) and the philisophy
(the spec), not expect to be spoon fed.

I could spend all day telling you how it works and linking to code snippets
(or having stupid arguments like this one) but then I'll never get any work done.

And I might as well do the implementation myself since I can do it twice as fast
if I don't have to go into painful details on the forums.

Let's look at the history:
"adrian at jboss.org" wrote : 
  | Then when constructing the map of valid values and doing the lookups
  | convert the xml values to lower case if the "ignoreCase" is true. 
  | 
Not all values can be converted to lower case:
"adrian at jboss.org" wrote : 
  | Yes. Obviously, you can't ignore case on an integer. ;-)
  | 

Next one:
"adrian at jboss.org" wrote : 
  | Everything is a String in xml :-)
  | 
And we got this from additional drill-down:
"adrian at jboss.org" wrote : 
  | "alesj" wrote : 
  |   | Who makes sure "1" is passed into EVA::cast as an Integer?
  |   | 
  | Its the xsd:type (or technically its parent type) of the attribute/element.
  | 

This one also isn't as obvious as it could be:
"adrian at jboss.org" wrote : 
  | 
  |   | @XmlEnum(type=Integer.class)
  |   | @JBossXmlEnum(ignoreCase=true)
  |   | public enum  Numbers
  |   | {
  |   |    @XmlEnumValue("ONE")
  |   |    ONE(1),
  |   | }
  |   | 
  | 
Defining Integer type + explicit String enum value.
OK, I'll can pass this one to 's&s' principle.
Though my first idea tells me that Integer.parse in IntegerEditor will complain since it will get passed "ONE". 
Or it could be that perhaps I again don't understand. ;-)



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137424#4137424

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137424



More information about the jboss-dev-forums mailing list