gpt4 book ai didi

java - Apache 公共(public) CLI : replacement for deprecated OptionBuilder?

转载 作者:太空狗 更新时间:2023-10-29 22:53:37 27 4
gpt4 key购买 nike

IntelliJ 显示 OptionBuilder 在来自 http://commons.apache.org/proper/commons-cli/usage.html 的示例代码中已弃用.

我应该用什么来代替?

import org.apache.commons.cli.*;

Options options = new Options();
options.addOption(OptionBuilder.withLongOpt( "block-size" )
.withDescription( "use SIZE-byte blocks" )
.hasArg()
.withArgName("SIZE")
.create());

最佳答案

来自 http://commons.apache.org/proper/commons-cli/javadocs/api-release/index.html

Deprecated. since 1.3, use Option.builder(String) instead

这是替换:

Options options = new Options();
Option option = Option.builder("a")
.longOpt( "block-size" )
.desc( "use SIZE-byte blocks" )
.hasArg()
.argName( "SIZE" )
.build();
options.addOption( option );

关于java - Apache 公共(public) CLI : replacement for deprecated OptionBuilder?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35050704/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com