本文整理了Java中net.sourceforge.argparse4j.inf.Namespace.getList()
方法的一些代码示例,展示了Namespace.getList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.getList()
方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.Namespace
类名称:Namespace
方法名:getList
[英]Returns attribute as List with given attribute name dest.
[中]使用给定的属性名称dest以列表形式返回属性。
代码示例来源:origin: dropwizard/dropwizard
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return contexts.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
}
代码示例来源:origin: dropwizard/dropwizard
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return contexts.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
}
代码示例来源:origin: dropwizard/dropwizard
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return contexts.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
}
代码示例来源:origin: dropwizard/dropwizard
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return contexts.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void run(Namespace namespace,
Liquibase liquibase) throws Exception {
final CheckSum checkSum = liquibase.calculateCheckSum("migrations.xml",
namespace.<String>getList("id").get(0),
namespace.<String>getList("author").get(0));
checkSumConsumer.accept(checkSum);
}
}
代码示例来源:origin: dropwizard/dropwizard
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return contexts.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
}
代码示例来源:origin: dropwizard/dropwizard
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return contexts.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
}
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void run(Namespace namespace, Liquibase liquibase) throws Exception {
liquibase.generateDocumentation(namespace.<String>getList("output").get(0));
}
}
代码示例来源:origin: signalapp/Signal-Server
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return Joiner.on(',').join(contexts);
}
}
代码示例来源:origin: signalapp/Signal-Server
private String getContext(Namespace namespace) {
final List<Object> contexts = namespace.getList("contexts");
if (contexts == null) {
return "";
}
return Joiner.on(',').join(contexts);
}
}
代码示例来源:origin: dropwizard/dropwizard
@Override
public void run(Namespace namespace, Liquibase liquibase) throws Exception {
liquibase.tag(namespace.<String>getList("tag-name").get(0));
}
}
代码示例来源:origin: spotify/helios
public List<String> getPubsubPrefixes() {
return options.getList(pubsubTopicPrefixArg.getDest());
}
代码示例来源:origin: spotify/helios
public List<String> getKafkaBrokers() {
final List<String> kafkaBrokers = options.getList(kafkaArg.getDest());
return kafkaBrokers.isEmpty() ? null : kafkaBrokers;
}
代码示例来源:origin: dropwizard/dropwizard
@Override
protected void run(Bootstrap<HelloWorldConfiguration> bootstrap,
Namespace namespace,
HelloWorldConfiguration configuration) throws Exception {
final Template template = configuration.buildTemplate();
if (namespace.getBoolean("include-default")) {
LOGGER.info("DEFAULT => {}", template.render(Optional.empty()));
}
for (String name : namespace.<String>getList("names")) {
for (int i = 0; i < 1000; i++) {
LOGGER.info("{} => {}", name, template.render(Optional.of(name)));
Thread.sleep(1000);
}
}
}
}
代码示例来源:origin: spotify/helios
public static Map<String, String> argToStringMap(final Namespace namespace, final Argument arg) {
final List<List<String>> args = namespace.getList(arg.getDest());
final Map<String, String> map = Maps.newHashMap();
if (args != null) {
for (final List<String> group : args) {
for (final String s : group) {
final String[] parts = s.split("=", 2);
if (parts.length != 2) {
throw new IllegalArgumentException("Bad " + arg.textualName() + " value: " + s);
}
map.put(parts[0], parts[1]);
}
}
}
return map;
}
代码示例来源:origin: spotify/helios
public static List<HostSelector> parseHostSelectors(final Namespace namespace,
final Argument arg) {
final List<List<String>> args = namespace.getList(arg.getDest());
final List<HostSelector> ret = Lists.newArrayList();
if (args != null) {
for (final List<String> group : args) {
for (final String s : group) {
final HostSelector hostSelector = HostSelector.parse(s);
if (hostSelector == null) {
throw new IllegalArgumentException(format("Bad host selector expression: '%s'", s));
}
ret.add(hostSelector);
}
}
}
return ret;
}
代码示例来源:origin: spotify/helios
@Override
int run(final Namespace options, final List<TargetAndClient> clients,
final PrintStream out, final boolean json, final BufferedReader stdin)
throws ExecutionException, InterruptedException, IOException {
final boolean exact = options.getBoolean(exactArg.getDest());
final List<String> prefixes = options.getList(prefixesArg.getDest());
final String jobIdString = options.getString(jobsArg.getDest());
final List<ListenableFuture<Map<JobId, Job>>> jobIdFutures = Lists.newArrayList();
for (final TargetAndClient cc : clients) {
jobIdFutures.add(cc.getClient().jobs(jobIdString));
}
final Set<JobId> jobIds = Sets.newHashSet();
for (final ListenableFuture<Map<JobId, Job>> future : jobIdFutures) {
jobIds.addAll(future.get().keySet());
}
watchJobsOnHosts(out, exact, prefixes, jobIds, options.getInt(intervalArg.getDest()),
clients);
return 0;
}
代码示例来源:origin: spotify/helios
@Override
protected int runWithJob(final Namespace options, final HeliosClient client,
final PrintStream out, final boolean json, final Job job,
final BufferedReader stdin)
throws ExecutionException, InterruptedException, IOException {
final JobId jobId = job.getId();
final List<String> hosts = options.getList(hostsArg.getDest());
final Deployment deployment = new Deployment.Builder()
.setGoal(Goal.START)
.setJobId(jobId)
.build();
if (!json) {
out.printf("Starting %s on %s%n", jobId, hosts);
}
return Utils.setGoalOnHosts(client, out, json, hosts, deployment,
options.getString(tokenArg.getDest()));
}
}
代码示例来源:origin: spotify/helios
@Override
protected int runWithJob(final Namespace options, final HeliosClient client,
final PrintStream out, final boolean json, final Job job,
final BufferedReader stdin)
throws ExecutionException, InterruptedException, IOException {
final JobId jobId = job.getId();
final List<String> hosts = options.getList(hostsArg.getDest());
final Deployment deployment = new Deployment.Builder()
.setGoal(Goal.STOP)
.setJobId(jobId)
.build();
if (!json) {
out.printf("Stopping %s on %s%n", jobId, hosts);
}
return Utils.setGoalOnHosts(client, out, json, hosts, deployment,
options.getString(tokenArg.getDest()));
}
}
代码示例来源:origin: spotify/helios
final List<String> explicitEndpoints = options.getList(globalArgs.masterArg.getDest());
final List<String> domains = options.getList(globalArgs.domainsArg.getDest());
final String srvName = options.getString(globalArgs.srvNameArg.getDest());
内容来源于网络,如有侵权,请联系作者删除!