You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Thomas Fox (JIRA)" <ji...@apache.org> on 2014/10/10 01:17:34 UTC

[jira] [Updated] (TORQUE-331) Make enum generation possible

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

Thomas Fox updated TORQUE-331:
------------------------------
    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() {...}
}

  was:
It should be possible to generate an enum for a value.
In the schema, this would look like
<column name="role" type="VARCHAR>
  <enumValue value="Admin" />
  <enumValue value="User" />
</column>
There should be an optional javaName Attribute for the enumValue element determining the java name for the enum value.
There should be an optional description Attribute for the enumValue 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 enumValue 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() {...};
}


> Make enum generation possible
> -----------------------------
>
>                 Key: TORQUE-331
>                 URL: https://issues.apache.org/jira/browse/TORQUE-331
>             Project: Torque
>          Issue Type: New Feature
>          Components: Templates
>    Affects Versions: 4.0
>            Reporter: Thomas Fox
>            Assignee: Thomas Fox
>             Fix For: 4.1
>
>
> 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() {...}
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org