本文整理了Java中org.apache.commons.cli.Option.clone()
方法的一些代码示例,展示了Option.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.clone()
方法的具体详情如下:
包路径:org.apache.commons.cli.Option
类名称:Option
方法名:clone
[英]A rather odd clone method - due to incorrect code in 1.0 it is public and in 1.1 rather than throwing a CloneNotSupportedException it throws a RuntimeException so as to maintain backwards compat at the API level. After calling this method, it is very likely you will want to call clearValues().
[中]一种非常奇怪的克隆方法——由于1.0中的代码不正确,它是公共的,而在1.1中,它不是抛出CloneNotSupportedException,而是抛出RuntimeException,以便在API级别保持向后兼容。调用此方法后,很可能需要调用clearValues()。
代码示例来源:origin: commons-cli/commons-cli
private void handleOption(Option option) throws ParseException
{
// check the previous option before handling the next one
checkRequiredArgs();
option = (Option) option.clone();
updateRequiredOptions(option);
cmd.addOption(option);
if (option.hasArg())
{
currentOption = option;
}
else
{
currentOption = null;
}
}
代码示例来源:origin: commons-cli/commons-cli
@Test
public void testSubclass()
{
Option option = new DefaultOption("f", "file", "myfile.txt");
Option clone = (Option) option.clone();
assertEquals("myfile.txt", clone.getValue());
assertEquals(DefaultOption.class, clone.getClass());
}
代码示例来源:origin: commons-cli/commons-cli
Option opt = (Option) getOptions().getOption(arg).clone();
代码示例来源:origin: horrorho/LiquidDonkey
public Options options() {
Options options = new Options();
propertyToOption.values().stream()
.map(option -> (Option) option.clone())
.forEach(options::addOption);
return options;
}
代码示例来源:origin: FINRAOS/herd
/**
* Adds an option instance. It may be specified as being mandatory.
*
* @param option the option that is to be added
* @param required specifies whether the option being added is mandatory
*
* @return the option that was added
*/
public Option addArgument(Option option, boolean required)
{
optionsIgnoreRequired.addOption((Option) option.clone());
option.setRequired(required);
options.addOption(option);
return option;
}
代码示例来源:origin: org.finra.herd/herd-core
/**
* Adds an option instance. It may be specified as being mandatory.
*
* @param option the option that is to be added
* @param required specifies whether the option being added is mandatory
*
* @return the option that was added
*/
public Option addArgument(Option option, boolean required)
{
optionsIgnoreRequired.addOption((Option) option.clone());
option.setRequired(required);
options.addOption(option);
return option;
}
代码示例来源:origin: linkedin/dynamometer
Option mapperClassNotRequiredOption = (Option) mapperClassOption.clone();
mapperClassNotRequiredOption.setRequired(false);
helpOptions.addOption(mapperClassNotRequiredOption);
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
private void handleOption(Option option) throws ParseException
{
// check the previous option before handling the next one
checkRequiredArgs();
option = (Option) option.clone();
updateRequiredOptions(option);
cmd.addOption(option);
if (option.hasArg())
{
currentOption = option;
}
else
{
currentOption = null;
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
Option opt = (Option) getOptions().getOption(arg).clone();
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.cli
Option opt = (Option) getOptions().getOption(arg).clone();
代码示例来源:origin: sdedit/sdedit
Option opt = (Option) getOptions().getOption(arg).clone();
内容来源于网络,如有侵权,请联系作者删除!