Java Code Examples for com.beust.jcommander.Parameters#commandNames()

The following examples show how to use com.beust.jcommander.Parameters#commandNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandSupport.java    From updatebot with Apache License 2.0 5 votes vote down vote up
protected void appendPullRequestComment(StringBuilder builder) {
    builder.append(COMMAND_COMMENT_INDENT);

    Parameters annotation = getClass().getAnnotation(Parameters.class);
    if (annotation != null) {
        String[] commandNames = annotation.commandNames();
        if (commandNames != null && commandNames.length > 0) {
            builder.append(commandNames[0]);
        }
    }
    appendPullRequestCommentArguments(builder);
    builder.append("\n");
}
 
Example 2
Source File: Metadata.java    From terracotta-platform with Apache License 2.0 5 votes vote down vote up
public static String getName(Command command) {
  Parameters annotation = command.getClass().getAnnotation(Parameters.class);
  if (annotation != null && annotation.commandNames().length > 0) {
    return annotation.commandNames()[0];
  }
  return command.getClass().getSimpleName().toLowerCase().replace("command", "");
}
 
Example 3
Source File: Command.java    From mojito with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the names of this command (should be long name first followed by
 * short name).
 *
 * @return list of command names
 */
public List<String> getNames() {
    Parameters parameters = getParameters();
    String[] commandNames = parameters.commandNames();
    return Arrays.asList(commandNames);
}