當前位置: 首頁>>代碼示例>>Java>>正文


Java Option類代碼示例

本文整理匯總了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);
      }
    }
  }
}
 
開發者ID:iisi-nj,項目名稱:GemFireLite,代碼行數:19,代碼來源:CommandBase.java

示例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");
      }
    }
  }
}
 
開發者ID:quelltextlich,項目名稱:jacoco-toolbox,代碼行數:18,代碼來源:ReportTool.java

示例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");
      }
    }
  }
}
 
開發者ID:quelltextlich,項目名稱:jacoco-toolbox,代碼行數:20,代碼來源:ReportTool.java

示例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);
  }
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:18,代碼來源:QueryAccounts.java

示例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");
		}
	};
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:24,代碼來源:HadoopLocalFeaturesToolOptions.java

示例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.");
}
 
開發者ID:verivital,項目名稱:hyst,代碼行數:31,代碼來源:Hyst.java

示例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;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:10,代碼來源:ListPlugins.java

示例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;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:10,代碼來源:SuggestReviewers.java

示例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;
}
 
開發者ID:gitblit,項目名稱:fathom,代碼行數:8,代碼來源:Settings.java

示例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;
}
 
開發者ID:gitblit,項目名稱:fathom,代碼行數:8,代碼來源:Settings.java

示例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;
}
 
開發者ID:gitblit,項目名稱:fathom,代碼行數:8,代碼來源:Settings.java

示例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;
}
 
開發者ID:gitblit,項目名稱:fathom,代碼行數:8,代碼來源:Settings.java

示例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;
}
 
開發者ID:gitblit,項目名稱:fathom,代碼行數:8,代碼來源:Settings.java

示例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;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:13,代碼來源:CheckMergeability.java


注:本文中的org.kohsuke.args4j.Option類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。