users@jaxb.java.net

Bind jaxb ENUM class to a java ENUM class

From: RPierce <rpierce_at_empoweredbenefits.com>
Date: Mon, 5 Apr 2010 06:59:55 -0700 (PDT)

Suppose I have an existing java enum class (Fruit.java) - is there a way to
define a jaxb class to be an instance of that java class? I'd like the jaxb
class to be backed by the java enum, so that if I need to extend the enum I
only have to modify the java class, not the java class AND the xsd.



package com.fruits;

public enum Fruit{

    APPLE("Apple"),
    PEAR("Pear"),
    BANANA("Banana");

    private String description;

    private DeductionType(String desc) {
        this.description = desc;
    }

    public String getDescription() {
        return description;
    }
}


...
<xs:simpleType name="Fruit">
     <xs:annotation>
        <xs:documentation>Backed using Fruit.java enum</xs:documentation>
         <!-- SOMETHING? -->
      </xs:annotation>
       <!-- Don't want to have to maintainrestriction, enumeration elements
-->
</xs:simpleType>
...






-- 
View this message in context: http://old.nabble.com/Bind-jaxb-ENUM-class-to-a-java-ENUM-class-tp28140264p28140264.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.