本文整理了Java中com.beust.jcommander.DynamicParameter
类的一些代码示例,展示了DynamicParameter
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DynamicParameter
类的具体详情如下:
包路径:com.beust.jcommander.DynamicParameter
类名称:DynamicParameter
暂无
代码示例来源:origin: naver/ngrinder
@Parameter(names = {"-m", "-mode", "--mode"}, required = false,
description = "run mode. The agent/monitor modes are available.", hidden = true)
public String mode = null;
@Parameter(names = {"-c", "-command", "--command"}, required = false, description = "execution command. " +
"The stop/start command are available.", hidden = true)
public String command = "start";
agent("run_agent") {
@Parameter(names = {"-ch", "--controller-host"}, required = false, description = "controller host or ip.")
public String controllerHost = null;
@DynamicParameter(names = "-D", description = "dynamic parameters", hidden = true)
public Map<String, String> params = new HashMap<String, String>();
代码示例来源:origin: com.beust/jcommander
String description;
if (Enum.class.isAssignableFrom(parameterized.getType())
&& parameterAnnotation.description().isEmpty()) {
description = "Options: " + EnumSet.allOf((Class<? extends Enum>) parameterized.getType());
}else {
description = parameterAnnotation.description();
initDescription(description, parameterAnnotation.descriptionKey(),
parameterAnnotation.names());
} else if (dynamicParameterAnnotation != null) {
initDescription(dynamicParameterAnnotation.description(),
dynamicParameterAnnotation.descriptionKey(),
dynamicParameterAnnotation.names());
} else {
throw new AssertionError("Shound never happen");
代码示例来源:origin: com.beust/jcommander
if (p.names().length == 0) {
p("Found main parameter:" + parameterized);
if (mainParameter != null) {
ParameterDescription pd =
new ParameterDescription(object, p, parameterized, options.bundle, this);
for (String name : p.names()) {
if (descriptions.containsKey(new StringKey(name))) {
throw new ParameterException("Found the option " + name + " multiple times");
descriptions.put(new StringKey(name), pd);
if (p.required()) requiredFields.put(parameterized, pd);
for (String name : dp.names()) {
if (descriptions.containsKey(name)) {
throw new ParameterException("Found the option " + name + " multiple times");
descriptions.put(new StringKey(name), pd);
if (dp.required()) requiredFields.put(parameterized, pd);
代码示例来源:origin: openscoring/openscoring
public class Evaluator extends ModelApplication {
@DynamicParameter (
names = {"-X"},
description = "Model arguments. For example, -Xkey=value"
代码示例来源:origin: org.jboss.pressgang.ccms/jcommander-pressgang
initDescription(m_parameterAnnotation.description(), m_parameterAnnotation.descriptionKey(), m_parameterAnnotation.names());
initMetaVar(m_parameterAnnotation.metaVar(), m_parameterAnnotation.metaVarKey());
} else if (m_dynamicParameterAnnotation != null) {
initDescription(m_dynamicParameterAnnotation.description(), m_dynamicParameterAnnotation.descriptionKey(),
m_dynamicParameterAnnotation.names());
initMetaVar(m_dynamicParameterAnnotation.metaVar(), m_dynamicParameterAnnotation.metaVarKey());
} else {
throw new AssertionError("Should never happen");
代码示例来源:origin: com.beust/jcommander
public String[] names() {
return parameter != null ? parameter.names() : dynamicParameter.names();
}
代码示例来源:origin: locationtech/geowave
if (getParam().getParameter() != null && getParam().getParameter().descriptionKey() != null) {
String descriptionKey = getParam().getParameter().descriptionKey();
if (descriptionKey != null && !"".equals(descriptionKey.trim())) {
descriptionKey = descriptionKey.trim();
&& getParam().getWrappedParameter().getDynamicParameter() != null) {
String descriptionKey =
getParam().getWrappedParameter().getDynamicParameter().descriptionKey();
if (descriptionKey != null && !"".equals(descriptionKey.trim())) {
descriptionKey = descriptionKey.trim();
if (getParam().getParameter() != null && getParam().getParameter().description() != null) {
description = getParam().getParameter().description();
} else if (getParam().isDynamicParameter()) {
description = getParam().getWrappedParameter().getDynamicParameter().description();
代码示例来源:origin: com.beust/jcommander
public boolean required() {
return parameter != null ? parameter.required() : dynamicParameter.required();
}
代码示例来源:origin: asakusafw/asakusafw
void add(DynamicParameter annotation) {
for (String name : annotation.names()) {
dynamicNames.add(name);
}
}
}
代码示例来源:origin: asakusafw/asakusafw
public class DotParameter {
@DynamicParameter(
names = { "-G", "--graph-option" },
descriptionKey = "parameter.graph-option")
Map<String, String> graphOptions = new LinkedHashMap<>();
@DynamicParameter(
names = { "-N", "--node-option" },
descriptionKey = "parameter.node-option")
Map<String, String> nodeOptions = new LinkedHashMap<>();
@DynamicParameter(
names = { "-E", "--edge-option" },
descriptionKey = "parameter.edge-option")
代码示例来源:origin: org.jboss.pressgang.ccms/jcommander-pressgang
public String[] names() {
return m_parameter != null ? m_parameter.names() : m_dynamicParameter.names();
}
代码示例来源:origin: org.jboss.pressgang.ccms/jcommander-pressgang
public boolean required() {
return m_parameter != null ? m_parameter.required() : m_dynamicParameter.required();
}
代码示例来源:origin: apache/accumulo
public class ShellOptionsJC {
@Parameter(names = {"-u", "--user"}, description = "username")
private String username = null;
@Parameter(names = {"-p", "--password"},
description = "password (can be specified as 'pass:<password>',"
+ " 'file:<local file containing the password>', 'env:<variable containing"
private String password;
@DynamicParameter(names = {"-l"},
description = "command line properties in the format key=value. Reuse -l for each property")
private Map<String,String> commandLineProperties = new TreeMap<>();
@Parameter(names = "--disable-tab-completion",
description = "disables tab completion (for less overhead when scripting)")
private boolean tabCompletionDisabled;
代码示例来源:origin: asakusafw/asakusafw
/**
* Handles parameters about applications.
* @since 0.10.0
*/
@Parameters(resourceBundle = "com.asakusafw.workflow.cli.jcommander")
public class ApplicationParameter {
/**
* The batch arguments.
*/
@DynamicParameter(
names = { "-A", "--batch-argument" },
descriptionKey = "parameter.batch-argument",
required = false
)
// NOTE: never final for JCommander
public Map<String, String> batchArguments = new LinkedHashMap<>();
/**
* Returns the batch arguments.
* @return the batch arguments
*/
public Map<String, String> getBatchArguments() {
return batchArguments;
}
}
代码示例来源:origin: org.jboss.pressgang.ccms/jcommander-pressgang
if (p.names().length == 0) {
p("Found main parameter:" + f);
if (m_mainParameterField != null) {
m_mainParameterDescription = new ParameterDescription(object, p, f, m_bundle, this);
} else {
for (String name : p.names()) {
if (m_descriptions.containsKey(name)) {
throw new ParameterException("Found the option " + name + " multiple times");
m_descriptions.put(name, pd);
if (p.required()) m_requiredFields.put(f, pd);
for (String name : dp.names()) {
if (m_descriptions.containsKey(name)) {
throw new ParameterException("Found the option " + name + " multiple times");
m_descriptions.put(name, pd);
if (dp.required()) m_requiredFields.put(f, pd);
代码示例来源:origin: locationtech/geowave
required = pd.getParameterized().getParameter().required();
} else if (pd.isDynamicParameter()) {
required = pd.getParameter().getDynamicParameter().required();
代码示例来源:origin: timolson/cointrader
static class MainParams {
@SuppressWarnings("UnusedDeclaration")
@Parameter(names = { "h", "help", "-h", "-H", "-help", "--help" }, help = true, description = "Show this usage help")
boolean help;
@Parameter(names = { "-f", "-properties-file" }, description = "location of the cointrader.properties config file")
String propertiesFilename = DEFAULT_PROPERTIES_FILENAME;
@DynamicParameter(names = { "-D" }, description = "use the -D flag to set configuration properties \"-Ddb.username=dbuser\"")
Map<String, String> definitions = new HashMap<>();
}
代码示例来源:origin: asakusafw/asakusafw
@DynamicParameter(
names = { "-L", "--location" },
descriptionKey = "parameter.location")
代码示例来源:origin: org.visallo/visallo-core
public class CreateUserArgs extends Args {
@Parameter(names = {"--username", "-u"}, required = true, arity = 1, description = "The username of the user to view or edit")
public String userName;
@Parameter(names = {"--password"}, required = true, arity = 1, description = "The password value to set")
public String password;
@Parameter(names = {"--displayname"}, arity = 1, description = "Display name to set")
public String displayName;
@Parameter(names = {"--email"}, arity = 1, description = "E-mail address to set")
public String email;
@DynamicParameter(names = "-A", description = "Additional arguments for the authorization repository")
public Map<String, String> authorizationRepositoryArguments = new HashMap<>();
@DynamicParameter(names = "-P", description = "Additional arguments for the privilege repository")
public Map<String, String> privilegeRepositoryArguments = new HashMap<>();
}
代码示例来源:origin: opencb/opencga
/**
* This class contains all those common parameters available for all 'subcommands'
*/
public class CommonOptions {
@Parameter(names = {"-h", "--help"}, description = "Print this help", help = true)
public boolean help;
@Parameter(names = {"-L", "--log-level"}, description = "One of the following: 'error', 'warn', 'info', 'debug', 'trace'")
public String logLevel = "info";
@Parameter(names = {"--log-file"}, description = "One of the following: 'error', 'warn', 'info', 'debug', 'trace'")
public String logFile;
@Parameter(names = {"-v", "--verbose"}, description = "Increase the verbosity of logs")
public boolean verbose = false;
@Parameter(names = {"-C", "--conf"}, description = "Configuration file path.")
public String configFile;
@Parameter(names = {"--storage-engine"}, arity = 1, description = "One of the listed in storage-configuration.yml")
public String storageEngine;
@DynamicParameter(names = "-D", description = "Storage engine specific parameters go here comma separated, ie. -Dmongodb" +
".compression=snappy", hidden = false)
public Map<String, String> params = new HashMap<>(); //Dynamic parameters must be initialized
}
内容来源于网络,如有侵权,请联系作者删除!