commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Sawle <jamessa...@hotmail.com>
Subject [lang] LANG-975
Date Thu, 09 Oct 2014 07:49:34 GMT
I have created a patch for the above issue, which adds a new method signature to simplify the
conversion from Strings to Booleans based upon a single true boolean String. This is therefore
unlike the other methods, which either take no parameters (use a prebuilt list of true and
false values), or require the user to provide a true, false and null value that the parameter
must match.
It has been pointed out by Duncan Jones, that this is jus syntactic sugar, due to it purely
wrapping the StringUtils.equals method. Therefore the question is, whether having this simple
method would drastically improve readability in calling code, or whether this would just be
code bloat for the sake of it.
Personally, there is another option, which would be to have a version of the method that takes
a varargs of true values. This could therefore be more useful in general cases, and could
be used to simplify some of the underlying String to boolean conversions. However, it should
then be noted that this would just become a contains check, with added protection around null
values. This would possibly also be more used to StringUtils with a wrapper method within
the BooleanUtils, which again raises the question of code bloat.
Any comments would be much appreciated. 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message