[ 
https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632944#action_12632944
 ] 

Stephen Colebourne commented on LANG-458:
-----------------------------------------

I would say that this class has a single purpose at present, and that is to act 
as an guard on entry to a method, with an exception being the result. We should 
not add isXxx methods returning a boolean to Validate.

Furthermore, I'm not sure there is any need for a class in [lang] that has 
those boolean return types. The majority of the functions of Validate that 
would be converted are available elsewhere, such as StringUtils.isEmpty, or 
CollectionUtils.isEmpty. 

> Add methods to return boolean from Validate.java instead of throwing 
> IllegalArgumentException
> ---------------------------------------------------------------------------------------------
>
>                 Key: LANG-458
>                 URL: https://issues.apache.org/jira/browse/LANG-458
>             Project: Commons Lang
>          Issue Type: Improvement
>         Environment: software
>            Reporter: Viraj Turakhia
>            Priority: Minor
>         Attachments: code_diff.txt, test_diff.txt
>
>
> I am using Validate.java since long and find it difficult to use when I just 
> want to validate collections or string.
> With current interface, I go like this:
> while(cnt < list.size()) {
>     List list1 = list.get(cnt);
>     try {
>         Validate.notEmpty(list1);
>     } catch(IllegalArgumentException e) {
>         continue;
>     }
> }
> much better approach is:
> while(cnt < list.size()) {
>     List list1 = list.get(cnt);
>     try {
>     if(! Validate.notEmpty(list1)) {
>         continue;
>     }
> }
> If you all agree with this change, I am willing to submit a patch for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to