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


Java Parameter類代碼示例

本文整理匯總了Java中com.beust.jcommander.Parameter的典型用法代碼示例。如果您正苦於以下問題:Java Parameter類的具體用法?Java Parameter怎麽用?Java Parameter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Parameter類屬於com.beust.jcommander包,在下文中一共展示了Parameter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getParameterBaseConverter

import com.beust.jcommander.Parameter; //導入依賴的package包/類
private static GeoWaveBaseConverter<?> getParameterBaseConverter(
		Parameter parameter ) {
	GeoWaveBaseConverter<?> converter = null;
	try {
		Constructor<?> ctor = parameter.converter().getConstructor(
				String.class);
		if (ctor != null) {
			converter = (GeoWaveBaseConverter<?>) ctor.newInstance(new Object[] {
				""
			});
		}
	}
	catch (Exception e) {
		LOGGER.error(
				"An error occurred getting converter from parameter: " + e.getLocalizedMessage(),
				e);
	}
	return converter;
}
 
開發者ID:locationtech,項目名稱:geowave,代碼行數:20,代碼來源:JCommanderParameterUtils.java

示例2: getConverterInstance

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Override
public IStringConverter<?> getConverterInstance(Parameter parameter, Class<?> forType, String optionName) {
	if (Path.class.equals(forType)) {
		return new CustomPathConverter();
	}
	return null;
}
 
開發者ID:tfiskgul,項目名稱:mux2fs,代碼行數:8,代碼來源:CommandLineArguments.java

示例3: appendPullRequestsCommentArguments

import com.beust.jcommander.Parameter; //導入依賴的package包/類
private void appendPullRequestsCommentArguments(StringBuilder builder, List<Field> fields, boolean namedArguments) {
    for (Field field : fields) {
        Parameter parameter = field.getAnnotation(Parameter.class);
        String[] names = parameter.names();
        if (names.length > 0) {
            String name = names[0];
            if (!namedArguments) {
                continue;
            }
            builder.append(" ");
            builder.append(name);
        } else {
            if (namedArguments) {
                continue;
            }
        }
        Object value = getFieldValue(field, this);
        if (value != null) {
            builder.append(" ");
            if (value instanceof Collection) {
                builder.append(Strings.join((Collection) value, " "));
            } else if (value instanceof Object[]) {
                builder.append(Strings.join(" ", (Object[]) value));
            } else {
                builder.append(value);
            }
        }
    }
}
 
開發者ID:fabric8-updatebot,項目名稱:updatebot,代碼行數:30,代碼來源:CommandSupport.java

示例4: generateFlagsInfo

import com.beust.jcommander.Parameter; //導入依賴的package包/類
private CharSequence generateFlagsInfo(Element classElement) throws ElementException {
  StringBuilder sb = new StringBuilder();
  AnnotationHelper<UsesFlags> annotation = annotationHelper(classElement, UsesFlags.class);
  if (annotation == null) {
    return sb;
  }
  StringBuilder flagsString = new StringBuilder();
  for (DeclaredType flag : annotation.getClassListValue("value")) {
    Element flagClass = flag.asElement();
    for (Element member : flagClass.getEnclosedElements()) {
      Parameter flagAnnotation = member.getAnnotation(Parameter.class);
      if (flagAnnotation == null
          || !(member instanceof VariableElement)
          || flagAnnotation.hidden()) {
        continue;
      }
      VariableElement field = (VariableElement) member;
      flagsString.append(Joiner.on(", ").join(flagAnnotation.names()));
      flagsString.append(" | *");
      flagsString.append(simplerJavaTypes(field));
      flagsString.append("* | ");
      flagsString.append(flagAnnotation.description());
      flagsString.append("\n");
    }
  }
  if (flagsString.length() > 0) {
    sb.append("\n\n**Command line flags:**\n\n");
    sb.append("Name | Type | Description\n");
    sb.append("---- | ----------- | -----------\n");
    sb.append(flagsString);
    sb.append("\n");
  }
  return sb;
}
 
開發者ID:google,項目名稱:copybara,代碼行數:35,代碼來源:MarkdownGenerator.java

示例5: setLog

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Parameter(
    names = {"-l", "--log"},
    converter = LogLevelConverter.class,
    description = "Set the log level of the CLI."
)
public void setLog(Level log) {
  GlobalOptions.getGlobalOptions().setLog(log);
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:9,代碼來源:NestableCommand.java

示例6: setTestcaseId

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Override
@Parameter(names = { "-c", "--testcase" }, arity = 1,
    description =
        "Test case for running conformance against test data. Possible values: [testcase0, testcase1a, testcase1b, testcase2, testcase3, testcase4]")
public void setTestcaseId(String testcaseId) {
    this.testcaseId = testcaseId;
}
 
開發者ID:esacinc,項目名稱:crigtt,代碼行數:8,代碼來源:CliValidatorOptionsImpl.java

示例7: ParameterRestFieldValue

import com.beust.jcommander.Parameter; //導入依賴的package包/類
public ParameterRestFieldValue(
		final Field field,
		final Parameter parameter,
		final Object instance ) {
	super(
			field,
			parameter);
	this.instance = instance;
}
 
開發者ID:locationtech,項目名稱:geowave,代碼行數:10,代碼來源:ParameterRestFieldValue.java

示例8: printConfig

import com.beust.jcommander.Parameter; //導入依賴的package包/類
private static void printConfig(Class configClass) throws IllegalAccessException, InstantiationException {
    Field[] fields = configClass.getDeclaredFields();
    System.out.println();
    System.out.println("### " + configClass.getSimpleName());
    System.out.println();
    Object defaultConfig = configClass.newInstance();

    System.out.println("|Name|Default|Description|");
    System.out.println("|---|---|---|");
    try {
        for (Field field : fields) {
            field.setAccessible(true);
            StringBuilder sb = new StringBuilder();
            sb.append("|");
            Parameter param = field.getDeclaredAnnotation(Parameter.class);

            if (param != null) {
                String names = Stream.of(param.names())
                        .collect(Collectors.joining(", "));
                // name
                sb.append(names).append("|");

                // default
                sb.append(param.required() ? "**required**" : field.get(defaultConfig) + " ").append("|");

                // description
                sb.append(param.description()).append("|");

                System.out.println(sb.toString());
            }

            ParametersDelegate delegate = field.getDeclaredAnnotation(ParametersDelegate.class);

            if (delegate != null) {
                printConfig(field.getType());
            }
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Merck,項目名稱:rdf2x,代碼行數:42,代碼來源:ReadmeUtils.java

示例9: appendPullRequestCommentArguments

import com.beust.jcommander.Parameter; //導入依賴的package包/類
/**
 * Appends any command specific parameters
 */
protected void appendPullRequestCommentArguments(StringBuilder builder) {
    List<Field> fields = findFieldsAnnotatedWith(getClass(), Parameter.class);
    appendPullRequestsCommentArguments(builder, fields, true);
    appendPullRequestsCommentArguments(builder, fields, false);
}
 
開發者ID:fabric8-updatebot,項目名稱:updatebot,代碼行數:9,代碼來源:CommandSupport.java

示例10: setOutput

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Parameter(names = { "-o", "--output" }, converter = FormatConverter.class, help = true, description = "Format the CLIs output.")
public void setOutput(AnsiFormatUtils.Format output) {
  GlobalOptions.getGlobalOptions().setOutput(output);
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:5,代碼來源:NestableCommand.java

示例11: setDebug

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Parameter(names = {"-d", "--debug"}, description = "Show detailed network traffic with halyard daemon.")
public void setDebug(boolean debug) {
  GlobalOptions.getGlobalOptions().setDebug(debug);
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:5,代碼來源:NestableCommand.java

示例12: setAlpha

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Parameter(names = {"-a", "--alpha"}, description = "Enable alpha halyard features.")
public void setAlpha(boolean alpha) {
  GlobalOptions.getGlobalOptions().setAlpha(alpha);
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:5,代碼來源:NestableCommand.java

示例13: setQuiet

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Parameter(names = {"-q", "--quiet"}, description = "Show no task information or messages. When set, ANSI formatting will be disabled, and all prompts will be accepted.")
public void setQuiet(boolean quiet) {
  GlobalOptions.getGlobalOptions().setQuiet(quiet);
  GlobalOptions.getGlobalOptions().setColor(!quiet);
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:6,代碼來源:NestableCommand.java

示例14: setColor

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Parameter(names = { "-c", "--color" }, description = "Enable terminal color output.", arity = 1)
public void setColor(boolean color) {
  GlobalOptions.getGlobalOptions().setColor(color);
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:5,代碼來源:NestableCommand.java

示例15: setDaemonEndpoint

import com.beust.jcommander.Parameter; //導入依賴的package包/類
@Parameter(names = { "--daemon-endpoint"}, description = "If supplied, connect to the daemon at this address.")
public void setDaemonEndpoint(String address) {
  GlobalOptions.getGlobalOptions().setDaemonEndpoint(address);
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:5,代碼來源:NestableCommand.java


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