Uploaded image for project: 'Torque'
  1. Torque
  2. TORQUE-331

Make enum generation possible

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 5.0
    • Templates
    • None

    Description

      It should be possible to generate an enum for a value.
      In the schema, this would look like
      <column name="role" type="VARCHAR>
      <enum-value value="Admin" />
      <enum-value value="User" />
      </column>
      There should be an optional javaName Attribute for the enum-value element determining the java name for the enum value.
      There should be an optional description Attribute for the enum-value element determining the javadoc for the enum value.
      There should be an optional enumName Attribute for the column element determining the type name for the enum. Its value can be either fully qualified or unqualified to create a new enum.
      If there are enum-value elements present, the enum type should be generated, otherwise, it is assumed to exist already and is not generated.

      The data object getters and setters signatures would then be
      public RoleEnum getRole();
      private void setRole(RoleEnum role);

      The generated enum like would look like
      public enum RoleEnum
      {
      ADMIN("Admin"),
      USER("User");

      private String value;
      private RoleEnum(String value)

      {...}
      private Sting getValue() {...}

      }

      Attachments

        Activity

          People

            tfischer Thomas Fox
            tfischer Thomas Fox
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: