castor
  1. castor
  2. CASTOR-2520

Type defined as a list of an enumerated string should use the enum

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3 rc1
    • Component/s: XML code generator
    • Labels:
      None
    • Environment:
      Linux splitter 2.6.24-19-server #1 SMP Sat Jul 12 00:40:01 UTC 2008 i686 GNU/Linux
      (Ubuntu with KDE desktop)
    • Number of attachments :
      2

      Description

      Consider the following constructs:

      	<xsd:simpleType name="WeightValue">
      		<xsd:restriction base="xsd:string">
      			<xsd:enumeration value="Right" />
      			<xsd:enumeration value="Wrong" />
      			<xsd:enumeration value="Neutral" />
      			<xsd:enumeration value="MoreRightThanWrong" />
      			<xsd:enumeration value="MoreWrongThanRight" />
      		</xsd:restriction>
      	</xsd:simpleType>
      	
      	<xsd:simpleType name="WeightValueList">
      		<xsd:list itemType="data:WeightValue" />
      	</xsd:simpleType>
      
      	<xsd:complexType name="FollowOnQuestionDef">
      		<xsd:simpleContent>
      			<xsd:extension base="xsd:ID">
      				<xsd:attribute name="usedForWeight"
      					type="data:WeightValueList" use="required">
      				</xsd:attribute>
      			</xsd:extension>
      		</xsd:simpleContent>
      	</xsd:complexType>
      

      The code generator builds the following Java:

            //--------------------------/
           //- Class/Member Variables -/
          //--------------------------/
      
          /**
           * internal content storage
           */
          private java.lang.String _content = "";
      
          /**
           * Field _usedForWeightList.
           */
          private java.util.List<java.lang.String> _usedForWeightList;
      

      That is, the list that implements the attribute is a string list. It does not use the enum type that is built (properly) from the WeightValue definition.

      1. castorbuilder.properties
        6 kB
        RWShore
      2. patch.c2520.20080904.txt
        3 kB
        Werner Guttmann

        Activity

        Hide
        Werner Guttmann added a comment -

        This is a bug, indeed. Will look into this. Can you please post your custom castorbuilder.properties, for completeness sake.

        Show
        Werner Guttmann added a comment - This is a bug, indeed. Will look into this. Can you please post your custom castorbuilder.properties, for completeness sake.
        Hide
        RWShore added a comment -

        Properties file used for the code generation

        Show
        RWShore added a comment - Properties file used for the code generation
        Hide
        Werner Guttmann added a comment -

        Patch to comment upon.

        Show
        Werner Guttmann added a comment - Patch to comment upon.

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            RWShore
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 2 hours, 35 minutes
              2h 35m