本文整理了Java中net.sourceforge.argparse4j.inf.Namespace.getAttrs()
方法的一些代码示例,展示了Namespace.getAttrs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.getAttrs()
方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.Namespace
类名称:Namespace
方法名:getAttrs
[英]Returns Map object holding attribute values.
The application code can freely use returned object.
[中]返回包含属性值的映射对象。
应用程序代码可以自由使用返回的对象。
代码示例来源:origin: atomix/atomix
/**
* Runs a standalone Atomix agent from the given command line arguments.
*
* @param args the program arguments
* @throws Exception if the supplied arguments are invalid
*/
public static void main(String[] args) throws Exception {
// Parse the command line arguments.
final List<String> unknown = new ArrayList<>();
final Namespace namespace = parseArgs(args, unknown);
final Namespace extraArgs = parseUnknown(unknown);
extraArgs.getAttrs().forEach((key, value) -> System.setProperty(key, value.toString()));
final Logger logger = createLogger(namespace);
final Atomix atomix = buildAtomix(namespace);
atomix.start().join();
logger.info("Atomix listening at {}", atomix.getMembershipService().getLocalMember().address());
final ManagedRestService rest = buildRestService(atomix, namespace);
rest.start().join();
logger.warn("The Atomix HTTP API is BETA and is intended for development and debugging purposes only!");
logger.info("HTTP server listening at {}", rest.address());
synchronized (Atomix.class) {
while (atomix.isRunning()) {
Atomix.class.wait();
}
}
}
代码示例来源:origin: google/graphicsfuzz
result.add(String.valueOf(innerSeed));
for (String arg : ns.getAttrs().keySet()) {
switch (arg) {
代码示例来源:origin: com.palantir.atlasdb/atlasdb-dropwizard-bundle
@Override
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws JsonProcessingException {
AtlasDbConfig cliConfiguration = AtlasDbCommandUtils.convertServerConfigToClientConfig(
configuration.getAtlasDbConfig(), configuration.getAtlasDbRuntimeConfig());
// We do this here because there's no flag to connect to an offline
// cluster in atlasdb-console (since this is passed in through bind)
if (isCliRunningOffline(namespace)) {
cliConfiguration = cliConfiguration.toOfflineConfig();
}
List<String> allArgs = ImmutableList.<String>builder()
.add("--bind")
.add("dropwizardAtlasDb")
.add(AtlasDbCommandUtils.serialiseConfiguration(cliConfiguration))
.add("--evaluate")
.add("connectInline dropwizardAtlasDb")
.addAll(AtlasDbCommandUtils.gatherPassedInArguments(namespace.getAttrs()))
.build();
runAtlasDbConsole(allArgs);
}
代码示例来源:origin: com.palantir.atlasdb/atlasdb-dropwizard-bundle
@Override
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
AtlasDbConfig cliConfiguration = AtlasDbCommandUtils.convertServerConfigToClientConfig(
configuration.getAtlasDbConfig(), configuration.getAtlasDbRuntimeConfig());
Map<String, OptionType> optionTypes = getCliOptionTypes();
Map<String, Object> globalAttrs = Maps.filterKeys(namespace.getAttrs(),
key -> optionTypes.get(key) == OptionType.GLOBAL);
Map<String, Object> groupAttrs = Maps.filterKeys(namespace.getAttrs(),
key -> optionTypes.get(key) == OptionType.GROUP);
Map<String, Object> commandAttrs = Maps.filterKeys(namespace.getAttrs(),
key -> optionTypes.get(key) == OptionType.COMMAND);
Iterable<String> groups = Iterables.limit(namespace.getList(COMMAND_NAME_ATTR), 1);
Iterable<String> commands = Iterables.skip(namespace.getList(COMMAND_NAME_ATTR), 1);
List<String> allArgs = ImmutableList.<String>builder()
.add("--inline-config")
.add(AtlasDbCommandUtils.serialiseConfiguration(cliConfiguration))
.addAll(AtlasDbCommandUtils.gatherPassedInArguments(globalAttrs))
.addAll(groups)
.addAll(AtlasDbCommandUtils.gatherPassedInArguments(groupAttrs))
.addAll(commands)
.addAll(AtlasDbCommandUtils.gatherPassedInArguments(commandAttrs))
.build();
try {
CLI.parse(allArgs).call();
} catch (Throwable e) {
log.error("Error running AtlasDB CLI", e);
throw e;
}
}
代码示例来源:origin: io.atomix/atomix-agent
/**
* Runs a standalone Atomix agent from the given command line arguments.
*
* @param args the program arguments
* @throws Exception if the supplied arguments are invalid
*/
public static void main(String[] args) throws Exception {
// Parse the command line arguments.
final List<String> unknown = new ArrayList<>();
final Namespace namespace = parseArgs(args, unknown);
final Namespace extraArgs = parseUnknown(unknown);
extraArgs.getAttrs().forEach((key, value) -> System.setProperty(key, value.toString()));
final Logger logger = createLogger(namespace);
final Atomix atomix = buildAtomix(namespace);
atomix.start().join();
logger.info("Atomix listening at {}", atomix.getMembershipService().getLocalMember().address());
final ManagedRestService rest = buildRestService(atomix, namespace);
rest.start().join();
logger.warn("The Atomix HTTP API is BETA and is intended for development and debugging purposes only!");
logger.info("HTTP server listening at {}", rest.address());
synchronized (Atomix.class) {
while (atomix.isRunning()) {
Atomix.class.wait();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!