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

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
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


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

       
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)

     [ https://issues.apache.org/jira/browse/CLI-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Blount updated CLI-224:
-----------------------------

    Attachment: DefaultOptionBuilderTest.java
                DefaultOptionBuilder.java
   

> 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

       
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

    [ 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

       
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

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

Duncan Jones commented on CLI-224:
----------------------------------

How about embedding a Builder class within Option and deprecating the public Option constructors and the OptionBuilder class. Hence we can:

{code}
new Option.Builder("opt", "description").argName("Foo").build();
{code}

without impacting existing code.
               

> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

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

Duncan Jones edited comment on CLI-224 at 9/19/12 8:25 AM:
-----------------------------------------------------------

How about embedding a Builder class within Option and deprecating the public Option constructors and the OptionBuilder class. Hence we can:

{code}
new Option.Builder("opt", "description").argName("Foo").build();
{code}

without impacting existing code. (This embedded builder style is suggested by Joshua Bloch in Effective Java.)
               
      was (Author: dmjones500):
    How about embedding a Builder class within Option and deprecating the public Option constructors and the OptionBuilder class. Hence we can:

{code}
new Option.Builder("opt", "description").argName("Foo").build();
{code}

without impacting existing code.
                 

> 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
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

     [ https://issues.apache.org/jira/browse/CLI-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Jones updated CLI-224:
-----------------------------

    Attachment: commons-cli-CLI-224.patch

Attached is an alternative patch, based on my suggestion of a nested builder class. I must thank Brian for the design of the unit test, which I have used in my patch.

I welcome comments.
               

> 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: commons-cli-CLI-224.patch, 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
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

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

Duncan Jones edited comment on CLI-224 at 9/21/12 7:42 AM:
-----------------------------------------------------------

Attached is an alternative patch (commons-cli-CLI-224.patch), based on my suggestion of a nested builder class. I must thank Brian for the design of the unit test, which I have used in my patch.

I welcome comments.
               
      was (Author: dmjones500):
    Attached is an alternative patch, based on my suggestion of a nested builder class. I must thank Brian for the design of the unit test, which I have used in my patch.

I welcome comments.
                 

> 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: commons-cli-CLI-224.patch, 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
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

     [ https://issues.apache.org/jira/browse/CLI-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Jones updated CLI-224:
-----------------------------

    Attachment:     (was: commons-cli-CLI-224.patch)
   

> 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: commons-cli-CLI-224.patch, 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
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

     [ https://issues.apache.org/jira/browse/CLI-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Duncan Jones updated CLI-224:
-----------------------------

    Attachment: commons-cli-CLI-224.patch

Corrected patch (missed Apache licence statement in new unit test).
               

> 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: commons-cli-CLI-224.patch, 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
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

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

Brian Blount commented on CLI-224:
----------------------------------

Duncan, this approach looks great to me.  Will there be a new release of 1.x with this change?
               

> 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: commons-cli-CLI-224.patch, 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
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|

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

Dmitri Blinov (Jira)
In reply to this post by Dmitri Blinov (Jira)

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

Duncan Jones commented on CLI-224:
----------------------------------

I've emailed the developer list to seek feedback on this issue. Hopefully it will result in somebody reviewing the patches and committing something to trunk. As for the next release, I'm not sure the plans for this, sorry.
               

> 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: commons-cli-CLI-224.patch, 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
For more information on JIRA, see: http://www.atlassian.com/software/jira