justinmclean commented on issue #5861:
URL: https://github.com/apache/gravitino/issues/5861#issuecomment-2544576417

   This is what is would look like. Add a verify method to the base `Command` 
class and a few common checkers.
   
   ```
   
     public Command verify() {
       return this;
     }
   
     public Command verifyTableName(String metalake, String catalog, String 
schema, String table) {
       if (metalake == null) {
         throw new IllegalArgumentException("Missing metalake name");
       }
       if (catalog == null) {
         throw new IllegalArgumentException("Missing catalog name");
       }
       if (schema == null) {
         throw new IllegalArgumentException("Missing schema name");
       }
       if (table == null) {
         throw new IllegalArgumentException("Missing table name");
       }
       return this;
     }
   ```
   
   (we may not need to check for metalake)
   
   in a command that needs to check table names add this:
   ```
     @Override
     public Command verify() {
       return verifyTableName(metalake, catalog, schema, table);
     }
   ```
   
   When calling the command chain verify and handle together:
   ```
         newListColumns(url, ignore, metalake, catalog, schema, 
table).verify().handle();
   ```
   


-- 
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-unsubscr...@gravitino.apache.org

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

Reply via email to