当前位置: 首页>>代码示例>>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;未经允许,请勿转载。