users@jaxb.java.net

Re: Getting a Java 5 enum from XJC

From: Gregory Kick <gk5885_at_gmail.com>
Date: Thu, 25 Jan 2007 16:29:18 -0800

Thanks for the quick reply!

Yeah, for some reason i'm getting

    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    protected String type;

for

<xs:complexType name="Class">
        <xs:complexContent>
            <xs:extension base="kse:Named">
                <xs:sequence>
                    <xs:element name="innerClass" type="kse:Class" minOccurs="0"
                        maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="type">
                    <xs:simpleType>
                        <xs:restriction base="xs:token">
                            <xs:enumeration value="annotation"/>
                            <xs:enumeration value="enum"/>
                            <xs:enumeration value="class"/>
                            <xs:enumeration value="interface"/>
                            <xs:enumeration value="throwable"/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

On 1/25/07, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
>
> Yes, in fact that's the default behavior.
>
> I take it that you aren't seeing it though. Can you paste your schema?
>
> Gregory Kick wrote:
> > Is it possible to have
> > <xs:restriction base="xs:token">
> > <xs:enumeration value="whatever"/>
> > ...
> > </xs:restriction>
> > generate a java 5 enum?
> >
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>


-- 
Gregory Kick
gk5885_at_gmail.com