[forge-issues] [JBoss JIRA] (FORGE-2484) java-new-enum-const should follow the naming convention

Antonio Goncalves (JIRA) issues at jboss.org
Thu Oct 1 16:51:00 EDT 2015


    [ https://issues.jboss.org/browse/FORGE-2484?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114338#comment-13114338 ] 

Antonio Goncalves commented on FORGE-2484:
------------------------------------------

[~gastaldi] You should rename the parameter {{enumClass}} with {{targetClass}} :

{code}
[MyEnum.java]$ java-add-enum-const   TAB
--enumClass  --named 
{code}

I thought deprecated command would not appear when having code completion. It's important to state that the command is deprecated and will soon disappear (like in scripting), but should not be displayed in code completion. WDYT ? : 

{code}
[proj]$ java-new-enum --named MyEnum
[MyEnum.java]$ java-new-enum   TAB
java-new-enum  java-new-enum-const  
[MyEnum.java]$ java-add-enum   TAB
java-add-enum-const  
[MyEnum.java]$ java-new-enum-const TEST
***WARNING*** The command 'Java: New Enum Const' is deprecated and will be removed in future versions. Use 'java-add-enum-const --named' instead
***SUCCESS*** Enum constants [TEST] created in org.proj.MyEnum
{code}

You mentioned the possibility to add several enums in a single command. I would be nice to still have it actually. This is not the case :
{code}
[MyEnum.java]$ java-add-enum-const --named VISA
***SUCCESS*** Enum constant 'VISA' added in org.myenum.MyEnum
[MyEnum.java]$ java-add-enum-const --named VISA1 VISA2 VISA3
***SUCCESS*** Enum constant 'VISA1' added in org.myenum.MyEnum    // Only VISA1 is created
{code}

We have this behavior with methods in JPA entity listeners where we use plural : {{lifecycles}} instead of {{lifecycle}}. If we follow this naming convention, that would be like renaming all the commands {{name}} and {{names}} instead of {{named}}. So we could have :

{code}
$ java-add-enum-const --name VISA1
$ java-add-enum-const --names VISA1 VISA2 VISA3
$ jpa-new-entity-listener --lifecycles PRE_PERSIST  PRE_REMOVE  PRE_UPDATE 
{code}

Too much refactoring :o(


> java-new-enum-const should follow the naming convention
> -------------------------------------------------------
>
>                 Key: FORGE-2484
>                 URL: https://issues.jboss.org/browse/FORGE-2484
>             Project: Forge
>          Issue Type: Sub-task
>          Components: Java EE
>    Affects Versions: 2.19.1.Final
>            Reporter: Antonio Goncalves
>            Assignee: George Gastaldi
>            Priority: Minor
>             Fix For: 2.x Future
>
>
> At the moment to add a new constant to an enum we type : 
> {code}
> java-new-enum-const VISA ;
> {code}
> To follow the other commands, it should have a {{named}} parameter
> {code}
> java-new-enum-const --named VISA ;
> java-new-enum-const --named MASTER_CARD ;
> java-new-enum-const --named AMERICAN_EXPRESS ;
> {code}
> Changing {{new}} to {{add}} we could end up with : 
> {code}
> java-add-enum-const --named VISA ;
> java-add-enum-const --named MASTER_CARD ;
> java-add-enum-const --named AMERICAN_EXPRESS ;
> {code}



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



More information about the forge-issues mailing list