本文整理了Java中com.beust.jcommander.Parameters.commandNames()
方法的一些代码示例,展示了Parameters.commandNames()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parameters.commandNames()
方法的具体详情如下:
包路径:com.beust.jcommander.Parameters
类名称:Parameters
方法名:commandNames
暂无
代码示例来源:origin: Netflix/genie
CommandFactory(
final List<AgentCommandArguments> agentCommandArguments,
final ApplicationContext applicationContext
) {
this.agentCommandArgumentsBeans = agentCommandArguments;
this.applicationContext = applicationContext;
agentCommandArguments.forEach(
commandArgs -> {
Sets.newHashSet(commandArgs.getClass().getAnnotation(Parameters.class).commandNames()).forEach(
commandName -> {
commandMap.put(commandName, commandArgs.getConsumerClass());
}
);
}
);
}
代码示例来源:origin: com.beust/jcommander
public void addCommand(Object object) {
Parameters p = object.getClass().getAnnotation(Parameters.class);
if (p != null && p.commandNames().length > 0) {
for (String commandName : p.commandNames()) {
addCommand(commandName, object);
}
} else {
throw new ParameterException("Trying to add command " + object.getClass().getName()
+ " without specifying its names in @Parameters");
}
}
代码示例来源:origin: asakusafw/asakusafw
static String getCommandName(Object command) {
Parameters parameters = command.getClass().getAnnotation(Parameters.class);
if (parameters == null || parameters.commandNames().length != 1) {
throw new IllegalStateException(MessageFormat.format(
"there are no valid command name information: {0}", //$NON-NLS-1$
command.getClass().getName()));
}
return parameters.commandNames()[0];
}
}
代码示例来源:origin: io.fabric8.updatebot/updatebot-core
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");
}
代码示例来源:origin: io.jenkins.updatebot/updatebot-core
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");
}
代码示例来源:origin: org.jboss.pressgang.ccms/jcommander-pressgang
public void addCommand(Object object) {
Parameters p = object.getClass().getAnnotation(Parameters.class);
if (p != null && p.commandNames().length > 0) {
for (String commandName : p.commandNames()) {
addCommand(commandName, object);
}
} else {
throw new ParameterException(
"Trying to add command " + object.getClass().getName() + " without specifying its names in @Parameters");
}
}
代码示例来源:origin: locationtech/geogig
/**
* Prints the JCommander usage for this command.
*/
public void printUsage(GeogigCLI cli) {
JCommander jc = new JCommander(this);
String commandName = this.getClass().getAnnotation(Parameters.class).commandNames()[0];
jc.setProgramName("geogig " + commandName);
cli.printUsage(jc);
}
代码示例来源:origin: org.locationtech.geogig/geogig-cli-core
/**
* Prints the JCommander usage for this command.
*/
public void printUsage(GeogigCLI cli) {
JCommander jc = new JCommander(this);
String commandName = this.getClass().getAnnotation(Parameters.class).commandNames()[0];
jc.setProgramName("geogig " + commandName);
cli.printUsage(jc);
}
代码示例来源:origin: org.locationtech.geogig/geogig-cli
/**
* Prints the JCommander usage for this command.
*/
public void printUsage(GeogigCLI cli) {
JCommander jc = new JCommander(this);
String commandName = this.getClass().getAnnotation(Parameters.class).commandNames()[0];
jc.setProgramName("geogig " + commandName);
cli.printUsage(jc);
}
代码示例来源:origin: com.netflix.genie/genie-agent
CommandFactory(
final List<AgentCommandArguments> agentCommandArguments,
final ApplicationContext applicationContext
) {
this.agentCommandArgumentsBeans = agentCommandArguments;
this.applicationContext = applicationContext;
agentCommandArguments.forEach(
commandArgs -> {
Sets.newHashSet(commandArgs.getClass().getAnnotation(Parameters.class).commandNames()).forEach(
commandName -> {
commandMap.put(commandName, commandArgs.getConsumerClass());
}
);
}
);
}
代码示例来源:origin: morfologik/morfologik-stemming
JCommander jc = new JCommander(command);
jc.addConverterFactory(new CustomParameterConverters());
jc.setProgramName(command.getClass().getAnnotation(Parameters.class).commandNames()[0]);
代码示例来源:origin: timolson/cointrader
for (String commandName : annotation.commandNames())
runModesByName.put(commandName, runMode);
parameterParser.addCommand(runMode);
内容来源于网络,如有侵权,请联系作者删除!