You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/12/27 09:30:35 UTC

[GitHub] [cloudstack] weizhouapache commented on a diff in pull request #7022: Normalize APIs getCommandName

weizhouapache commented on code in PR #7022:
URL: https://github.com/apache/cloudstack/pull/7022#discussion_r1057556701


##########
api/src/main/java/org/apache/cloudstack/api/BaseCmd.java:
##########
@@ -270,9 +267,22 @@ public String getActualCommandName() {
         } else {
             cmdName = this.getClass().getName();
         }
-       return cmdName;
+        return cmdName;
     }
 
+    public static String getCommandNameByClass(Class<?> clazz) {
+        String cmdName = null;
+        if (clazz.getAnnotation(APICommand.class) != null) {

Review Comment:
   ```suggestion
           if (clazz.getAnnotation(APICommand.class) != null && clazz.getAnnotation(APICommand.class).name() != null) {
               cmdName = clazz.getAnnotation(APICommand.class).name();
           } else {
               cmdName = clazz.getName();
               // TODO: remove "Cmd" and "CmdByAdmin" from class name.
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org