commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Jonker <...@pobox.com>
Subject Re: [lang] Proposal (2): isEmpty
Date Sat, 19 Jul 2003 16:14:41 GMT
If we are changing the semantics of isEmpty  AT ALL, then any client code
will need to be altered in order for its operation to remain unchanged.
Which means the safest thing for all users to do, to guarantee that their
programs' behaviors are not changed, is to simply search-and-replace
"StringUtils.isEmpty(" with "StringUtils.isBlank("

Which to me implies that we might as well give isEmpty the correct semantics
relative to the standard, Sun-defined meaning of "empty".

In other words, is we are correcting isEmpty to not trim, we're not saving
anyone any work by keeping to true on null.

I still "vote" for Stephen's earlier proposal.  I don't mind the long names
because they are accurate and non-misleading, unlike the current names (and
some of those below).


On 7/18/03 6:33 PM, scolebourne@btopenworld.com wrote:

> Proposal for methods:
> 
> - isEmpty() - true for "" or null
> - isNotEmpty() - opposite
> - isEmptyNN() - true for ""
> 
> - isBlank() - trims - true for "  ", "" or null
> - isNotBlank() - opposite
> - isBlankNN() - trims - true for "  " or ""
> 
> - isWhitespace() - true for all whitespace, "" or null
> - isNotWhitespace() - opposite
> - isWhitespaceNN() - true for all whitespace or ""
> 
> Where NN means NotNull.
> This covers all the cases, and takes the working premise that more people
> want null to be true than false.
> 
> 
> Proposal for location:
> 1) In StringUtils. Incompatable change to isEmpty() (no longer trims) and
> isWhitespace() (null now true).
> 
> 2) In StringTests (new class). Deprecate StringUtils isEmpty/isNotEmpty.
> 
> 
> I prefer the incompatable change #1. We are offering a simply named
> alternative. Also, some people already don't expect isEmpty to trim. And
> Tapestry and Turbine should both be OK.
> 
> Stephen
> 
> PS. If no agreement is forthcoming, then we shall have to revert to the 1.0
> methods in order to get a release.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 
> 

-- 

A patriot must always be ready to defend his country against its
government.  -Edward Abbey, naturalist and author (1927-1989)

    Defend our country!  Vote Howard Dean 2004
        http://www.DeanForAmerica.com/
        http://www.MoveOn.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message