Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334832 - [OXM] Simplify <xml-enum-value> for default case
Summary: [OXM] Simplify <xml-enum-value> for default case
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-19 14:47 EST by Rick Barkhouse CLA
Modified: 2022-06-09 10:03 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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