[ 
https://issues.apache.org/jira/browse/CXF-1427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Phil Clay updated CXF-1427:
---------------------------

    Description: 
If a wsdl definition contains an element and separate type definition like the 
following:

<xs:element name="MyEnumField" type="MyEnum" />

<xs:simpleType name="MyEnum">
        <xs:restriction base="xs:string">
                <xs:enumeration value="Value0"/>
                <xs:enumeration value="Value1"/>
        </xs:restriction>
</xs:simpleType>

then wsdl2java will generate a first class java enumeration (public enum 
MyEnum), and the field will be of the MyEnum type (protected MyEnum 
myEnumField).  This is perfect.


However, if the type is inlined, such as the following:

<xs:element name="MyEnumField">
        <xs:simpleType>
                <xs:restriction base="xs:string">
                        <xs:enumeration value="Value0"/>
                        <xs:enumeration value="Value1"/>
                </xs:restriction>
        </xs:simpleType>
</xs:element>

then wsdl2java will not generate a first class enumeration, and the myEnumField 
will instead be a String (protected String myEnumField).

It would be nice if the inline type definition generated a java enumeration as 
well.  I'm not sure what the name of the enum would be.  Maybe something that 
combines the containing type name and the element name?

  was:
If a wsdl definition contains an element and separate type definition like the 
following:

<xs:element name="MyEnumField" type="MyEnum" />

<xs:simpleType name="MyEnum">
        <xs:restriction base="xs:string">
                <xs:enumeration value="Value0"/>
                <xs:enumeration value="Value1"/>
        </xs:restriction>
</xs:simpleType>

then wsdl2java will generate a first class java enumeration (public enum 
MyEnum), and the field will be of the MyEnum type (protected MyEnum 
myEnumField).  This is perfect.


However, if the type is inlined, such as the following:

<xs:element name="MyEnumField">
        <xs:simpleType name="MyEnum">
                <xs:restriction base="xs:string">
                        <xs:enumeration value="Value0"/>
                        <xs:enumeration value="Value1"/>
                </xs:restriction>
        </xs:simpleType>
</xs:element>

then wsdl2java will not generate a first class enumeration, and the myEnumField 
will instead be a String (protected String myEnumField).

It would be nice if the inline type definition generated a java enumeration as 
well.  I'm not sure what the name of the enum would be.  Maybe something that 
combines the containing type name and the element name?


> wsdl2java: Generate first class Java enum for inline element
> ------------------------------------------------------------
>
>                 Key: CXF-1427
>                 URL: https://issues.apache.org/jira/browse/CXF-1427
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.0.3
>         Environment: n/a
>            Reporter: Phil Clay
>            Priority: Minor
>
> If a wsdl definition contains an element and separate type definition like 
> the following:
> <xs:element name="MyEnumField" type="MyEnum" />
> <xs:simpleType name="MyEnum">
>       <xs:restriction base="xs:string">
>               <xs:enumeration value="Value0"/>
>               <xs:enumeration value="Value1"/>
>       </xs:restriction>
> </xs:simpleType>
> then wsdl2java will generate a first class java enumeration (public enum 
> MyEnum), and the field will be of the MyEnum type (protected MyEnum 
> myEnumField).  This is perfect.
> However, if the type is inlined, such as the following:
> <xs:element name="MyEnumField">
>       <xs:simpleType>
>               <xs:restriction base="xs:string">
>                       <xs:enumeration value="Value0"/>
>                       <xs:enumeration value="Value1"/>
>               </xs:restriction>
>       </xs:simpleType>
> </xs:element>
> then wsdl2java will not generate a first class enumeration, and the 
> myEnumField will instead be a String (protected String myEnumField).
> It would be nice if the inline type definition generated a java enumeration 
> as well.  I'm not sure what the name of the enum would be.  Maybe something 
> that combines the containing type name and the element name?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to