本文整理汇总了Java中org.kohsuke.args4j.Option类的典型用法代码示例。如果您正苦于以下问题:Java Option类的具体用法?Java Option怎么用?Java Option使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Option类属于org.kohsuke.args4j包,在下文中一共展示了Option类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import org.kohsuke.args4j.Option; //导入依赖的package包/类
public void parse()
{
cmdFields = new TreeSet<CmdField>();
for (Class c = getClass(); c != null; c = c.getSuperclass())
{
for (Field f : c.getDeclaredFields())
{
Option o = f.getAnnotation(Option.class);
if (o != null)
{
CmdField cf = new CmdField();
cf.field = f;
cf.option = o;
cmdFields.add(cf);
}
}
}
}
示例2: addAnalyze
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = "--analyze-for", usage = "Add a file to analyze for. This "
+ "can be a plain class file, a jar file, or a directory. Multiple "
+ "paths can be provided in one string by concatenating them using "
+ "colons (':'). Empty paths get discarded.")
void addAnalyze(final String analyzeFor) {
for (final String singleAnalyzeFor : analyzeFor.split(":")) {
if (!singleAnalyzeFor.isEmpty()) {
final File file = new File(singleAnalyzeFor);
if (!file.exists()) {
exit("The file '" + file + "' does not exist");
}
if (!analyzeFors.add(file)) {
exit("Could not add '" + file + "' to analyzes");
}
}
}
}
示例3: addSource
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = "--source", usage = "Add a directory to search sources in. "
+ "Multiple paths can be provided in one string by concatenating them "
+ "using colons (':'). Empty paths get discarded.")
void addSource(final String source) {
for (final String singleSource : source.split(":")) {
if (!singleSource.isEmpty()) {
final File file = new File(singleSource);
if (!file.exists()) {
exit("The file '" + file + "' does not exist");
}
if (!file.isDirectory()) {
exit("The file '" + file + "' is not a directory");
}
if (!sources.add(file)) {
exit("Could not add '" + file + "' to sources");
}
}
}
}
示例4: setLimit
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of users to return"
)
public void setLimit(int n) {
queryProcessor.setUserProvidedLimit(n);
if (n < 0) {
suggestLimit = 10;
} else if (n == 0) {
suggestLimit = MAX_SUGGEST_RESULTS;
} else {
suggestLimit = Math.min(n, MAX_SUGGEST_RESULTS);
}
}
示例5: getOptions
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Override
public MapperModeOp getOptions() {
return new MapperModeOp() {
@Option(
name = "--threads",
aliases = "-j",
required = false,
usage = "Use NUMBER threads per mapper. defaults n processors.",
metaVar = "NUMBER")
private int concurrency = Runtime.getRuntime().availableProcessors();
@Override
public void prepareJobMapper(Job job, Class<LocalFeaturesMapper> mapperClass) {
if (concurrency <= 0)
concurrency = Runtime.getRuntime().availableProcessors();
job.setMapperClass(MultithreadedMapper.class);
MultithreadedMapper.setNumberOfThreads(job, concurrency);
MultithreadedMapper.setMapperClass(job, mapperClass);
System.out.println("Using multithreaded mapper");
}
};
}
示例6: getPlexusCompatibleType
import org.kohsuke.args4j.Option; //导入依赖的package包/类
static Type getPlexusCompatibleType(Option option, Field f) {
Type fieldType = f.getGenericType();
Class<?> specialCase = TYPE_SPECIAL_CASES.get(option.name());
if (specialCase != null) {
return specialCase;
}
if (fieldType instanceof Class<?>) {
Class<?> typeFromClass = getTypeFromClass((Class<?>) fieldType);
if (typeFromClass != null) {
return typeFromClass;
}
}
if (fieldType instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) fieldType;
Type rt = pt.getRawType();
if (rt instanceof Class<?>
&& Collection.class.isAssignableFrom((Class<?>) rt)) {
Type[] params = pt.getActualTypeArguments();
if (params.length == 1 && params[0] instanceof Class<?>) {
Class<?> elementType = getTypeFromClass((Class<?>) params[0]);
if (elementType != null) {
return listOfElements(elementType).getType();
}
}
}
}
fail("Does not know how to convert " + fieldType
+ ":" + fieldType.getClass());
return null;
}
开发者ID:mikesamuel,项目名称:closure-maven-plugin,代码行数:33,代码来源:CheckJsOptionsCompatibleWithCompilerFlagsTest.java
示例7: setTool
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = FLAG_TOOL, aliases = {
"-t" }, usage = "target tool and tool params", metaVar = "TOOLNAME TOOLPARAMS", handler = PairStringOptionHandler.class)
public void setTool(String[] params) throws CmdLineException
{
if (params.length != 2)
throw new CmdLineException(parser, hystLocalizable,
"-tool expected exactly two follow-on arguments: TOOL_NAME TOOL_PARAMS (params can be explicit empty string). See -help_printers.");
toolParamsString = params[1];
// look through all the model generators for the right one
for (ToolPrinter tp : printers)
{
String flag = tp.getCommandLineFlag();
if (flag.startsWith("-"))
throw new RuntimeException(
"tool's command-line flag shouldn't start with a hyphen: " + flag);
if (flag.equalsIgnoreCase(params[0]))
{
toolPrinter = tp;
break;
}
}
if (toolPrinter == null)
throw new CmdLineException(parser, hystLocalizable,
"-tool parameter '" + params[0] + "' was invalid.");
}
示例8: setStart
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of plugins to skip"
)
public void setStart(int start) {
this.start = start;
}
示例9: setQuery
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(
name = "--query",
aliases = {"-q"},
metaVar = "QUERY",
usage = "match reviewers query"
)
public void setQuery(String q) {
this.query = q;
}
示例10: httpPort
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = "--httpPort", metaVar = "PORT",
usage = "Port for serving HTTP.\nPORT <= 0 will disable this transport.")
public Settings httpPort(int port) {
this.overrideSetting(Setting.undertow_httpPort, port);
return this;
}
示例11: httpListenAddress
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = "--httpListenAddress", metaVar = "ADDRESS",
usage = "Interface to use for serving HTTP.")
public Settings httpListenAddress(String address) {
this.overrideSetting(Setting.undertow_httpListenAddress, address);
return this;
}
示例12: httpsPort
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = "--httpsPort", metaVar = "PORT",
usage = "Port for serving HTTPS.\nPORT <= 0 will disable this transport.")
public Settings httpsPort(int port) {
this.overrideSetting(Setting.undertow_httpsPort, port);
return this;
}
示例13: ajpPort
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = "--ajpPort", metaVar = "PORT",
usage = "Port for serving AJP.\nPORT <= 0 will disable this transport.")
public Settings ajpPort(int port) {
this.overrideSetting(Setting.undertow_ajpPort, port);
return this;
}
示例14: ajpListenAddress
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(name = "--ajpListenAddress", metaVar = "ADDRESS",
usage = "Interface to use for serving AJP.")
public Settings ajpListenAddress(String address) {
this.overrideSetting(Setting.undertow_ajpListenAddress, address);
return this;
}
示例15: setSource
import org.kohsuke.args4j.Option; //导入依赖的package包/类
@Option(
name = "--source",
metaVar = "COMMIT",
usage =
"the source reference to merge, which could be any git object "
+ "references expression, refer to "
+ "org.eclipse.jgit.lib.Repository#resolve(String)",
required = true
)
public void setSource(String source) {
this.source = source;
}