Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334832

Summary: [OXM] Simplify <xml-enum-value> for default case
Product: z_Archived Reporter: Rick Barkhouse <rick.barkhouse>
Component: EclipselinkAssignee: Project Inbox <eclipselink.oxm-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: blaise.doughan, paul.fullbright
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Rick Barkhouse CLA 2011-01-19 14:47:48 EST
Using Java annotations, the user can have an enum like this:

   @XmlEnum(String.class)
   private enum CustomerType { PROMO_CUSTOMER, NEW_CUSTOMER, VIP, NORMAL }
 
Because no @XmlEnumValue annotations were specified, the constant names themselves will be marshalled to XML (e.g. <customer-type>VIP</customer-type>)

However in OXM, you are forced to define the constant names twice:

   <xml-enum java-enum="CustomerType" value="java.lang.String">
      <xml-enum-value java-enum-value="PROMO_CUSTOMER">PROMO_CUSTOMER</xml-enum-value>
      <xml-enum-value java-enum-value="NEW_CUSTOMER">NEW_CUSTOMER</xml-enum-value>
      <xml-enum-value java-enum-value="VIP">VIP</xml-enum-value>
      <xml-enum-value java-enum-value="NORMAL">NORMAL</xml-enum-value>
   </xml-enum>

It would be nice if the user could just specify the value once for this default case, such as:

   <xml-enum java-enum="CustomerType" value="java.lang.String">
      <xml-enum-value java-enum-value="PROMO_CUSTOMER"/>
      <xml-enum-value java-enum-value="NEW_CUSTOMER"/>
      <xml-enum-value java-enum-value="VIP"/>
      <xml-enum-value java-enum-value="NORMAL"/>
   </xml-enum>
Comment 1 Paul Fullbright CLA 2013-02-07 14:38:32 EST
It would be even easier if one just got the java settings for free.

Does that not exist currently?
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:03:09 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink