You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Emmanuel Bourg (Commented) (JIRA)" <ji...@apache.org> on 2011/12/15 11:48:30 UTC

[jira] [Commented] (CLI-224) OptionBuilder only has static methods, yet many return an OptionBuilder instance

    [ https://issues.apache.org/jira/browse/CLI-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13170117#comment-13170117 ] 

Emmanuel Bourg commented on CLI-224:
------------------------------------

Thank you for the code Brian, a revamped builder could be included in the 1.x line, but I'm still hesitating on the proper way do to it. The existing OptionBuilder can't be changed due to binary compatibility issues, so another class has to provide the builder mechanism. I haven't found an elegant solution yet: "DefaultOptionBuilder" looks a bit heavy, "Options" is already used, "OptBuilder" is shorter but probably less explicit.

The solution might be to add chained withXXX() setters to the Option class. Building an option would then look like this:

{code}new Option("f").withLongOpt("file").withDescription("Input file").withArg();{code}

Any input on this matter is welcome.
                
> OptionBuilder only has static methods, yet many return an OptionBuilder instance
> --------------------------------------------------------------------------------
>
>                 Key: CLI-224
>                 URL: https://issues.apache.org/jira/browse/CLI-224
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-1.x
>    Affects Versions: 1.2
>            Reporter: Brian Blount
>         Attachments: DefaultOptionBuilder.java, DefaultOptionBuilderTest.java
>
>
> CLI-83 was closed as fixed in 2.0, but it seems that there is no current plan to release CLI 2.0.  Could this fix be rolled into the 1.x line?  I'm attaching a new version of option builder that addresses the issue (named DefaultOptionBuilder to maintain backwards compatability) and a unit test for it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira