本文整理了Java中net.sourceforge.argparse4j.inf.Namespace.<init>()
方法的一些代码示例,展示了Namespace.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.<init>()
方法的具体详情如下:
包路径:net.sourceforge.argparse4j.inf.Namespace
类名称:Namespace
方法名:<init>
[英]Construct this object using given attrs.
[中]使用给定属性构造此对象。
代码示例来源:origin: guardianproject/haven
public void run() {
Main mainSignal = new Main(mContext);
HashMap<String, Object> map = new HashMap<>();
map.put("username", mUsername);
map.put("command", "register");
if (!callEnabled)
map.put("voice", false);
else
map.put("voice", true);
Namespace ns = new Namespace(map);
mainSignal.handleCommands(ns);
}
});
代码示例来源:origin: guardianproject/haven
public void run() {
Main mainSignal = new Main(mContext);
HashMap<String, Object> map = new HashMap<>();
map.put("username", mUsername);
map.put("command", "verify");
map.put("verificationCode", verificationCode);
Namespace ns = new Namespace(map);
mainSignal.handleCommands(ns);
}
});
代码示例来源:origin: guardianproject/haven
public void run() {
Main mainSignal = new Main(mContext);
HashMap<String, Object> map = new HashMap<>();
map.put("username", mUsername);
map.put("endsession",false);
map.put("recipient", recipients);
map.put("command", "send");
map.put("message", message);
if (attachment != null)
{
ArrayList<String> attachments = new ArrayList<>();
attachments.add(attachment);
map.put("attachment",attachments);
}
Namespace ns = new Namespace(map);
mainSignal.handleCommands(ns);
}
});
代码示例来源:origin: atomix/atomix
/**
* Parses unknown arguments, returning an argparse4j namespace.
*
* @param unknown the unknown arguments to parse
* @return the namespace
* --foo.bar baz --bar.baz foo bar --foo.bar.baz bang
*/
static Namespace parseUnknown(List<String> unknown) {
Map<String, Object> attrs = new HashMap<>();
String attr = null;
for (String arg : unknown) {
if (arg.startsWith("--")) {
int splitIndex = arg.indexOf('=');
if (splitIndex == -1) {
attr = arg.substring(2);
} else {
attrs.put(arg.substring(2, splitIndex), arg.substring(splitIndex + 1));
attr = null;
}
} else if (attr != null) {
attrs.put(attr, arg);
attr = null;
}
}
return new Namespace(attrs);
}
代码示例来源:origin: dropwizard/dropwizard
file = Collections.emptyMap();
final Namespace namespace = new Namespace(file);
代码示例来源:origin: net.sourceforge.argparse4j/argparse4j
@Override
public Namespace parseArgs(String args[]) throws ArgumentParserException {
Map<String, Object> attrs = new HashMap<String, Object>();
parseArgs(args, attrs);
return new Namespace(attrs);
}
代码示例来源:origin: net.sourceforge.argparse4j/argparse4j
@Override
public Namespace parseKnownArgs(String args[], List<String> unknown)
throws ArgumentParserException {
Map<String, Object> attrs = new HashMap<String, Object>();
parseKnownArgs(args, unknown, attrs);
return new Namespace(attrs);
}
代码示例来源:origin: argparse4j/argparse4j
@Override
public Namespace parseArgs(String args[]) throws ArgumentParserException {
Map<String, Object> attrs = new HashMap<String, Object>();
parseArgs(args, attrs);
return new Namespace(attrs);
}
代码示例来源:origin: argparse4j/argparse4j
@Override
public Namespace parseKnownArgs(String args[], List<String> unknown)
throws ArgumentParserException {
Map<String, Object> attrs = new HashMap<String, Object>();
parseKnownArgs(args, unknown, attrs);
return new Namespace(attrs);
}
代码示例来源:origin: xvik/dropwizard-guicey
private void startCommand(final Bootstrap<C> bootstrap) throws Exception {
command = new TestCommand<>(application);
final ImmutableMap.Builder<String, Object> file = ImmutableMap.builder();
if (!Strings.isNullOrEmpty(configPath)) {
file.put("file", configPath);
}
final Namespace namespace = new Namespace(file.build());
command.run(bootstrap, namespace);
}
代码示例来源:origin: ru.vyarus/dropwizard-guicey
private void startCommand(final Bootstrap<C> bootstrap) throws Exception {
command = new TestCommand<>(application);
final ImmutableMap.Builder<String, Object> file = ImmutableMap.builder();
if (!Strings.isNullOrEmpty(configPath)) {
file.put("file", configPath);
}
final Namespace namespace = new Namespace(file.build());
command.run(bootstrap, namespace);
}
代码示例来源:origin: io.atomix/atomix-agent
/**
* Parses unknown arguments, returning an argparse4j namespace.
*
* @param unknown the unknown arguments to parse
* @return the namespace
* --foo.bar baz --bar.baz foo bar --foo.bar.baz bang
*/
static Namespace parseUnknown(List<String> unknown) {
Map<String, Object> attrs = new HashMap<>();
String attr = null;
for (String arg : unknown) {
if (arg.startsWith("--")) {
int splitIndex = arg.indexOf('=');
if (splitIndex == -1) {
attr = arg.substring(2);
} else {
attrs.put(arg.substring(2, splitIndex), arg.substring(splitIndex + 1));
attr = null;
}
} else if (attr != null) {
attrs.put(attr, arg);
attr = null;
}
}
return new Namespace(attrs);
}
代码示例来源:origin: com.yammer.dropwizard/dropwizard-testing
private void startIfRequired() {
if (jettyServer != null) {
return;
}
try {
service = serviceClass.newInstance();
final Bootstrap<C> bootstrap = new Bootstrap<C>(service) {
@Override
public void runWithBundles(C configuration, Environment environment) throws Exception {
environment.addServerLifecycleListener(new ServerLifecycleListener() {
@Override
public void serverStarted(Server server) {
jettyServer = server;
}
});
DropwizardServiceRule.this.configuration = configuration;
DropwizardServiceRule.this.environment = environment;
super.runWithBundles(configuration, environment);
}
};
service.initialize(bootstrap);
final ServerCommand<C> command = new ServerCommand<C>(service);
final Namespace namespace = new Namespace(ImmutableMap.<String, Object>of("file", configPath));
command.run(bootstrap, namespace);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: io.dropwizard/dropwizard-testing
file.put("file", configPath);
final Namespace namespace = new Namespace(file.build());
代码示例来源:origin: openstack/monasca-common
private void startIfRequired() {
if (jettyServer != null) {
return;
}
try {
application = newApplication();
final Bootstrap<C> bootstrap = new Bootstrap<C>(application) {
@Override
public void run(C configuration, Environment environment) throws Exception {
environment.lifecycle().addServerLifecycleListener(new ServerLifecycleListener() {
@Override
public void serverStarted(Server server) {
jettyServer = server;
}
});
AbstractAppTest.this.configuration = configuration;
AbstractAppTest.this.environment = environment;
super.run(configuration, environment);
}
};
application.initialize(bootstrap);
final ServerCommand<C> command = new ServerCommand<>(application);
final Namespace namespace = new Namespace(ImmutableMap.<String, Object>of("file", configPath));
command.run(bootstrap, namespace);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!