Skip to content

Added 1 and 0 in toBooleanObject(final String str) #502

Merged
garydgregory merged 2 commits into
apache:masterfrom
dscham:master
Mar 7, 2020
Merged

Added 1 and 0 in toBooleanObject(final String str) #502
garydgregory merged 2 commits into
apache:masterfrom
dscham:master

Conversation

@dscham

@dscham dscham commented Mar 7, 2020

Copy link
Copy Markdown
Contributor

I stubmled over this during the week and am wondering why 1 and 0 are not a default true and false representation. So I created this PR. I'm not strongly opnionated about it. So if there is a good reason for 1 and 0 not beeing a good case here, feel free to close it.

I think, parsing the string to an int before calling toBoolean is unnecessary. And it should be common enough that you shouldn't have to call: toBooleanObject(final String str, final String trueString, final String falseString, final String nullString)

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.006%) to 95.103% when pulling 2170a00 on dscham:master into ba607f5 on apache:master.

@garydgregory

Copy link
Copy Markdown
Member

OK by me as it also matches javax.xml.bind.DatatypeConverter.parseBoolean(String)

@garydgregory garydgregory merged commit fde46a2 into apache:master Mar 7, 2020
@garydgregory

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants