[forge-issues] [JBoss JIRA] (FORGE-2479) Being able to add a constant to a target class

Antonio Goncalves (JIRA) issues at jboss.org
Tue Sep 15 09:37:00 EDT 2015


Antonio Goncalves created FORGE-2479:
----------------------------------------

             Summary: Being able to add a constant to a target class
                 Key: FORGE-2479
                 URL: https://issues.jboss.org/browse/FORGE-2479
             Project: Forge
          Issue Type: Sub-task
          Components: Java EE
    Affects Versions: 2.19.0.Final
            Reporter: Antonio Goncalves
             Fix For: 2.x Future


At the moment we can add a field to a target class with the {{java-new-field}} command (which by the way should be renamed to  {{java-add-field}}). It generates getters, setters, updates the {{toString}} method....

It would be good to have a command to add a constant to a target class (no need to have getters, setter...). So something as simple as : 

{code}
java-add-constant --name MyConstant 
{code}

By default it will be a String. The command will uppercase the name and set it public static final :

{code}
public class MyClass {
   public static final String MY_CONSTANT ;
}
{code}

We could set a value, change the access type :

{code}
java-add-constant --name MyConstant --value "My Value" --accessType private
{code}

Will generate : 
{code}
public class MyClass {
   private static final String MY_CONSTANT = "My Value";
}
{code}




--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the forge-issues mailing list