net.sourceforge.argparse4j.inf.Namespace.getString()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中net.sourceforge.argparse4j.inf.Namespace.getString()方法的一些代码示例,展示了Namespace.getString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.getString()方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.Namespace
类名称:Namespace
方法名:getString

Namespace.getString介绍

[英]Returns attribute as String with given attribute name dest. This method calls Object#toString() method of a found object to get string representation unless object is null.
[中]

代码示例

代码示例来源:origin: dropwizard/dropwizard

@Override
  public void run(Namespace namespace, Liquibase liquibase) throws Exception {
    final AbstractLiquibaseCommand<T> subcommand =
      requireNonNull(subcommands.get(namespace.getString(COMMAND_NAME_ATTR)), "Unable find the command");
    subcommand.run(namespace, liquibase);
  }
}

代码示例来源:origin: signalapp/Signal-Server

@Override
 public void run(Namespace namespace, Liquibase liquibase) throws Exception {
  final AbstractLiquibaseCommand<T> subcommand = subcommands.get(namespace.getString(COMMAND_NAME_ATTR));
  subcommand.run(namespace, liquibase);
 }
}

代码示例来源:origin: spotify/helios

public String getSentryDsn() {
 return options.getString(sentryDsnArg.getDest());
}

代码示例来源:origin: spotify/helios

public String getStatsdHostPort() {
 return options.getString(statsdHostPortArg.getDest());
}

代码示例来源:origin: spotify/helios

public String getDomain() {
 return options.getString(domainArg.getDest());
}

代码示例来源:origin: spotify/helios

public String getServiceRegistryAddress() {
 return options.getString(serviceRegistryArg.getDest());
}

代码示例来源:origin: spotify/helios

public String getName() {
 return options.getString(nameArg.getDest());
}

代码示例来源:origin: spotify/helios

public String getZooKeeperAclMasterUser() {
 return options.getString(zooKeeperAclMasterUser.getDest());
}

代码示例来源:origin: spotify/helios

public String getZooKeeperClusterId() {
 return options.getString(zooKeeperClusterId.getDest());
}

代码示例来源:origin: spotify/helios

public String getZooKeeperAclAgentUser() {
 return options.getString(zooKeeperAclAgentUser.getDest());
}

代码示例来源:origin: spotify/helios

public String getZooKeeperConnectString() {
 return options.getString(zooKeeperConnectStringArg.getDest());
}

代码示例来源:origin: spotify/helios

public Path getStateDirectory() {
 return Paths.get(options.getString(stateDirArg.getDest()));
}

代码示例来源:origin: dropwizard/dropwizard

CloseableLiquibase openLiquibase(final PooledDataSourceFactory dataSourceFactory, final Namespace namespace)
    throws SQLException, LiquibaseException {
  final CloseableLiquibase liquibase;
  final ManagedDataSource dataSource = dataSourceFactory.build(new MetricRegistry(), "liquibase");
  final Database database = createDatabase(dataSource, namespace);
  final String migrationsFile = namespace.getString("migrations-file");
  if (migrationsFile == null) {
    liquibase = new CloseableLiquibaseWithClassPathMigrationsFile(dataSource, database, migrationsFileName);
  } else {
    liquibase = new CloseableLiquibaseWithFileSystemMigrationsFile(dataSource, database, migrationsFile);
  }
  return liquibase;
}

代码示例来源:origin: SeldonIO/seldon-server

public ItemSimilarityProcessor(final Namespace ns)
{
  this.windowSecs = ns.getInt("window_secs");
  this.windowProcessed = ns.getInt("window_processed");
  this.outputTopic = ns.getString("output_topic");
  this.kafkaServers = ns.getString("kafka");
  System.out.println(ns);
  this.streamJaccard = new StreamingJaccardSimilarity(windowSecs, ns.getInt("hashes"), ns.getInt("min_activity"));
  //createOutputSimilaritiesTimer(ns);
}

代码示例来源:origin: spotify/helios

protected FastForwardConfig ffwdConfig(final Namespace options) {
  if (!options.getBoolean(ffwdEnabled.getDest())) {
   return null;
  }

  return new FastForwardConfig(
    Optional.ofNullable(options.getString(ffwdAddress.getDest())),
    options.getInt(ffwdInterval.getDest()),
    options.getString(ffwdMetricKey.getDest()));
 }
}

代码示例来源:origin: dropwizard/dropwizard

@Override
public void run(Namespace namespace, Liquibase liquibase) throws Exception {
  final String tag = namespace.getString("tag");
  final Integer count = namespace.getInt("count");
  final Date date = namespace.get("date");
  final boolean dryRun = namespace.getBoolean("dry-run") == null ? false : namespace.getBoolean("dry-run");
  final String context = getContext(namespace);
  if (Stream.of(tag, count, date).filter(Objects::nonNull).count() != 1) {
    throw new IllegalArgumentException("Must specify either a count, a tag, or a date.");
  }
  if (count != null) {
    if (dryRun) {
      liquibase.rollback(count, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
    } else {
      liquibase.rollback(count, context);
    }
  } else if (tag != null) {
    if (dryRun) {
      liquibase.rollback(tag, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
    } else {
      liquibase.rollback(tag, context);
    }
  } else {
    if (dryRun) {
      liquibase.rollback(date, context, new OutputStreamWriter(outputStream, StandardCharsets.UTF_8));
    } else {
      liquibase.rollback(date, context);
    }
  }
}

代码示例来源:origin: spotify/helios

@Override
int run(final Namespace options, final HeliosClient client, final PrintStream out,
    final boolean json, final BufferedReader stdin)
  throws ExecutionException, InterruptedException {
 final String name = options.getString(nameArg.getDest());
 final boolean full = options.getBoolean(fullArg.getDest());
 return run0(client, out, json, name, full);
}

代码示例来源:origin: dropwizard/dropwizard

private Database createDatabase(
  ManagedDataSource dataSource,
  Namespace namespace
) throws SQLException, LiquibaseException {
  final DatabaseConnection conn = new JdbcConnection(dataSource.getConnection());
  final Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(conn);
  final String catalogName = namespace.getString("catalog");
  final String schemaName = namespace.getString("schema");
  if (database.supportsCatalogs() && catalogName != null) {
    database.setDefaultCatalogName(catalogName);
    database.setOutputDefaultCatalog(true);
  }
  if (database.supportsSchemas() && schemaName != null) {
    database.setDefaultSchemaName(schemaName);
    database.setOutputDefaultSchema(true);
  }
  return database;
}

代码示例来源:origin: atomix/atomix

/**
 * Builds a REST service for the given Atomix instance from the given namespace.
 *
 * @param atomix the Atomix instance
 * @param namespace the namespace from which to build the service
 * @return the managed REST service
 */
private static ManagedRestService buildRestService(Atomix atomix, Namespace namespace) {
 final String httpHost = namespace.getString("http_host");
 final Integer httpPort = namespace.getInt("http_port");
 return RestService.builder()
   .withAtomix(atomix)
   .withAddress(Address.from(httpHost, httpPort))
   .build();
}

代码示例来源:origin: dropwizard/dropwizard

@Override
@SuppressWarnings("unchecked")
public void run(Bootstrap<?> wildcardBootstrap, Namespace namespace) throws Exception {
  final Bootstrap<T> bootstrap = (Bootstrap<T>) wildcardBootstrap;
  configuration = parseConfiguration(bootstrap.getConfigurationFactoryFactory(),
                    bootstrap.getConfigurationSourceProvider(),
                    bootstrap.getValidatorFactory().getValidator(),
                    namespace.getString("file"),
                    getConfigurationClass(),
                    bootstrap.getObjectMapper());
  try {
    if (configuration != null) {
      configuration.getLoggingFactory().configure(bootstrap.getMetricRegistry(),
                            bootstrap.getApplication().getName());
    }
    run(bootstrap, namespace, configuration);
  } finally {
    if (!asynchronous) {
      cleanup();
    }
  }
}

相关文章