当前位置: 首页>>代码示例>>Java>>正文


Java KeyValuePair类代码示例

本文整理汇总了Java中joptsimple.util.KeyValuePair的典型用法代码示例。如果您正苦于以下问题:Java KeyValuePair类的具体用法?Java KeyValuePair怎么用?Java KeyValuePair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KeyValuePair类属于joptsimple.util包,在下文中一共展示了KeyValuePair类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
@Override
protected void execute(Terminal terminal, OptionSet options) throws Exception {
    final Map<String, String> settings = new HashMap<>();
    for (final KeyValuePair kvp : settingOption.values(options)) {
        if (kvp.value.isEmpty()) {
            throw new UserException(ExitCodes.USAGE, "Setting [" + kvp.key + "] must not be empty");
        }
        settings.put(kvp.key, kvp.value);
    }

    putSystemPropertyIfSettingIsMissing(settings, "path.conf", "es.path.conf");
    putSystemPropertyIfSettingIsMissing(settings, "path.data", "es.path.data");
    putSystemPropertyIfSettingIsMissing(settings, "path.home", "es.path.home");
    putSystemPropertyIfSettingIsMissing(settings, "path.logs", "es.path.logs");

    execute(terminal, options, createEnv(terminal, settings));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:EnvironmentAwareCommand.java

示例2: configureParser

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
/**
 * Configures the parser and specifies all the options which are available
 * for the command. It allows to perform validation of all the command line.
 */
@Override
public void configureParser() {
	mavenReference = parser
			.accepts(MAVEN_REFERENCE.value(),
					MAVEN_REFERENCE_DESCRIPTION.value())
			.withRequiredArg()
			.describedAs(MAVEN_REFERENCE_ARG.value())
			.ofType(String.class)
			.withValuesConvertedBy(
					regex("([a-zA-Z_0-9-_.])+[:]([a-zA-Z_0-9-_.])+[:]([a-zA-Z_0-9-_.])+"))
			.required();
	parser.accepts(GENERATE_POM.value(), GENERATE_POM_DESCRIPTION.value());
	mavenCommand = parser
			.accepts(MAVEN_CMD.value(), MAVEN_CMD_DESCRIPTION.value())
			.withRequiredArg()
			.describedAs(MAVEN_CMD_ARG.value())
			.ofType(String.class)
			.withValuesConvertedBy(
					regex("([a-zA-Z_0-9-_.])+([:]([a-zA-Z_0-9-_.])+)?"))
			.ofType(String.class).required();
	mavenParameters = parser
			.accepts(JVM_PARAM.value(), JVM_PARAM_DESCRIPTION.value())
			.withRequiredArg().describedAs(JVM_PARAM_ARG.value())
			.ofType(KeyValuePair.class);
}
 
开发者ID:awltech,项目名称:clic,代码行数:30,代码来源:MavenCommand.java

示例3: handleLongOptionToken

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
void handleLongOptionToken( String candidate, ArgumentList arguments, OptionSet detected ) {
    KeyValuePair optionAndArgument = parseLongOptionWithArgument( candidate );

    if ( !isRecognized( optionAndArgument.key ) )
        // GemFire Addition : Add options detected so far
        throw createUnrecognizedOptionException( optionAndArgument.key, detected );

    AbstractOptionSpec<?> optionSpec = specFor( optionAndArgument.key );
    optionSpec.handleOption( this, arguments, detected, optionAndArgument.value );
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:11,代码来源:OptionParser.java

示例4: handleShortOptionToken

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
void handleShortOptionToken( String candidate, ArgumentList arguments, OptionSet detected ) {
    KeyValuePair optionAndArgument = parseShortOptionWithArgument( candidate );

    if ( isRecognized( optionAndArgument.key ) ) {
        specFor( optionAndArgument.key ).handleOption( this, arguments, detected, optionAndArgument.value );
    }
    else
        handleShortOptionCluster( candidate, arguments, detected );
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:10,代码来源:OptionParser.java

示例5: listToProperties

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
private Properties listToProperties(List<KeyValuePair> kvps) {
  Properties p = new Properties();
  for (KeyValuePair kvp : kvps) {
    p.put(kvp.key, kvp.value);
  }
  return p;
}
 
开发者ID:hcoles,项目名称:pitest,代码行数:8,代码来源:OptionsParser.java

示例6: handleLongOptionToken

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
void handleLongOptionToken( String candidate, ArgumentList arguments, OptionSet detected ) {
    KeyValuePair optionAndArgument = parseLongOptionWithArgument( candidate );

    if ( !isRecognized( optionAndArgument.key ) )
        throw unrecognizedOption( optionAndArgument.key );

    AbstractOptionSpec<?> optionSpec = specFor( optionAndArgument.key );
    optionSpec.handleOption( this, arguments, detected, optionAndArgument.value );
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:10,代码来源:OptionParser.java

示例7: computeMavenParameters

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
/**
 * Computes all the maven parameters provided in the command line and adds
 * them in the {@link #mavenRequest}
 * 
 * @param context
 *            the command context used for writing in the console
 */
private void computeMavenParameters(final CommandContext context) {
	if (!options.has(mavenParameters)) {
		context.write(NO_PARAMETERS.value());
		return;
	}
	context.write(PARAMETERS_FOUND.value(options.valuesOf(mavenParameters)
			.size()));
	final Properties props = new Properties();
	for (final KeyValuePair pair : options.valuesOf(mavenParameters))
		props.put(pair.key, pair.value);
	mavenRequest.setProperties(props);
}
 
开发者ID:awltech,项目名称:clic,代码行数:20,代码来源:MavenCommand.java

示例8: EnvironmentAwareCommand

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
public EnvironmentAwareCommand(String description) {
    super(description);
    this.settingOption = parser.accepts("E", "Configure a setting").withRequiredArg().ofType(KeyValuePair.class);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:EnvironmentAwareCommand.java

示例9: parseLongOptionWithArgument

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
private static KeyValuePair parseLongOptionWithArgument( String argument ) {
    return KeyValuePair.valueOf( argument.substring( 2 ) );
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:4,代码来源:OptionParser.java

示例10: parseShortOptionWithArgument

import joptsimple.util.KeyValuePair; //导入依赖的package包/类
private static KeyValuePair parseShortOptionWithArgument( String argument ) {
    return KeyValuePair.valueOf( argument.substring( 1 ) );
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:4,代码来源:OptionParser.java


注:本文中的joptsimple.util.KeyValuePair类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。