commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duncan Jones (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LANG-975) New BooleanUtils method toBoolean(String, String)
Date Wed, 08 Oct 2014 20:16:34 GMT

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

Duncan Jones updated LANG-975:
------------------------------
    Fix Version/s:     (was: Patch Needed)
                   Discussion
                   Review Patch

Thanks for the patch. At first glance, it looks fine.

But it does raise the question - is this method really necessary? As your patch demonstrates,
this code is essentially just string comparison. I question whether it's worth bloating the
class to include this syntactic sugar.

If we do implement this, we would need to add the same overload for the other similar methods
in the class.

[~jamessawle]: If you want to speed this discussion process up, you could fire an email around
the Commons dev mailing list (prefix subject with {{[lang]}}) and request some feedback. My
vote would be not to implement this.

> New BooleanUtils method toBoolean(String, String)
> -------------------------------------------------
>
>                 Key: LANG-975
>                 URL: https://issues.apache.org/jira/browse/LANG-975
>             Project: Commons Lang
>          Issue Type: Wish
>          Components: lang.*
>    Affects Versions: 3.2.1
>            Reporter: Stephan Knitelius
>            Priority: Minor
>             Fix For: Review Patch, Discussion
>
>         Attachments: LANG-975.patch
>
>
> The BooleanUtils#toBoolean(String) works nicely for common boolean String notations.
> However there are many more boolean String notations such as 1/0, ja/nein etc... 
> I know this can be achieved via BooleanUtils#toBoolean(String,String,String), however
it would be nice to have another Method that only matches the true case, so that invalid cases
are automatically matched to false. 
> eg:
> BooleanUtils.toBoolean("1", "1")    = true
> BooleanUtils.toBoolean("foo", "1") = false



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message