ddanielr commented on PR #5922:
URL: https://github.com/apache/accumulo/pull/5922#issuecomment-3324843195
> Does this function exactly the same in usage and help output?
Yes. If a command name is not passed into the `addCommand` method then
jcommander looks at that object's parameters and gets the commandName value
from there.
Both methods end up calling `this.addCommand`
```
public void addCommand(String name, Object object) {
this.addCommand(name, object);
}
public void addCommand(Object object) {
Parameters p =
(Parameters)object.getClass().getAnnotation(Parameters.class);
if (p != null && p.commandNames().length > 0) {
String[] var3 = p.commandNames();
int var4 = var3.length;
for(int var5 = 0; var5 < var4; ++var5) {
String commandName = var3[var5];
this.addCommand(commandName, object);
}
} else {
throw new ParameterException("Trying to add command " +
object.getClass().getName() + " without specifying its names in @Parameters");
}
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]