[jira] [Created] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)
Null-Check to variable Object parameters - ObjectUtils.isAnyNull
----------------------------------------------------------------

                 Key: LANG-781
                 URL: https://issues.apache.org/jira/browse/LANG-781
             Project: Commons Lang
          Issue Type: New Feature
          Components: lang.*
    Affects Versions: 3.1
            Reporter: Sandro Lehmann
            Priority: Minor


Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), if there is a method like isAnyNull(obj1, obj2, ...). It is much more readable.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)

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

Sandro Lehmann updated LANG-781:
--------------------------------

    Attachment: ObjectUtils.java.patch
   

> Null-Check to variable Object parameters - ObjectUtils.isAnyNull
> ----------------------------------------------------------------
>
>                 Key: LANG-781
>                 URL: https://issues.apache.org/jira/browse/LANG-781
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Sandro Lehmann
>            Priority: Minor
>              Labels: patch
>         Attachments: ObjectUtils.java.patch
>
>
> Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), if there is a method like isAnyNull(obj1, obj2, ...). It is much more readable.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Sandro Lehmann updated LANG-781:
--------------------------------

    Attachment: ObjectUtilsTest.java.patch
   

> Null-Check to variable Object parameters - ObjectUtils.isAnyNull
> ----------------------------------------------------------------
>
>                 Key: LANG-781
>                 URL: https://issues.apache.org/jira/browse/LANG-781
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Sandro Lehmann
>            Priority: Minor
>              Labels: patch
>         Attachments: ObjectUtils.java.patch, ObjectUtilsTest.java.patch
>
>
> Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), if there is a method like isAnyNull(obj1, obj2, ...). It is much more readable.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Sandro Lehmann updated LANG-781:
--------------------------------

    Description: Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), using a method like isAnyNull(obj1, obj2, ...) would be much better.  (was: Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), if there is a method like isAnyNull(obj1, obj2, ...). It is much more readable.)
   

> Null-Check to variable Object parameters - ObjectUtils.isAnyNull
> ----------------------------------------------------------------
>
>                 Key: LANG-781
>                 URL: https://issues.apache.org/jira/browse/LANG-781
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Sandro Lehmann
>            Priority: Minor
>              Labels: patch
>         Attachments: ObjectUtils.java.patch, ObjectUtilsTest.java.patch
>
>
> Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), using a method like isAnyNull(obj1, obj2, ...) would be much better.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Gary D. Gregory commented on LANG-781:
--------------------------------------

Maybe something for org.apache.commons.lang3.Validate too?
               

> Null-Check to variable Object parameters - ObjectUtils.isAnyNull
> ----------------------------------------------------------------
>
>                 Key: LANG-781
>                 URL: https://issues.apache.org/jira/browse/LANG-781
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Sandro Lehmann
>            Priority: Minor
>              Labels: patch
>         Attachments: ObjectUtils.java.patch, ObjectUtilsTest.java.patch
>
>
> Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), using a method like isAnyNull(obj1, obj2, ...) would be much better.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Matt Benson commented on LANG-781:
----------------------------------

Yes, this is mostly satisfied by {{Validate.noNullElements()}}, however, the short version of the signature is not set up to handle varargs, presumably because we didn't anticipate this (ahem) use-case.  I think that we would remain binary compatible if we just add the varargs even now; do the CLIRR nazis ;) among us agree?
               

> Null-Check to variable Object parameters - ObjectUtils.isAnyNull
> ----------------------------------------------------------------
>
>                 Key: LANG-781
>                 URL: https://issues.apache.org/jira/browse/LANG-781
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Sandro Lehmann
>            Priority: Minor
>              Labels: patch
>         Attachments: ObjectUtils.java.patch, ObjectUtilsTest.java.patch
>
>
> Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), using a method like isAnyNull(obj1, obj2, ...) would be much better.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Sandro Lehmann commented on LANG-781:
-------------------------------------

But in Validate an Exception is thrown but if you want to use it in an IF (i.e. if(obj1==null || obj2==null || ...)) you cannot use it.
               

> Null-Check to variable Object parameters - ObjectUtils.isAnyNull
> ----------------------------------------------------------------
>
>                 Key: LANG-781
>                 URL: https://issues.apache.org/jira/browse/LANG-781
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Sandro Lehmann
>            Priority: Minor
>              Labels: patch
>         Attachments: ObjectUtils.java.patch, ObjectUtilsTest.java.patch
>
>
> Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), using a method like isAnyNull(obj1, obj2, ...) would be much better.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (LANG-781) Null-Check to variable Object parameters - ObjectUtils.isAnyNull

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Henri Yandell commented on LANG-781:
------------------------------------

Both sound valuable.

Matt - simplest is to add the code and run CLIRR :) We should use a different JIRA item for the Validate.noNullElements(...).
               

> Null-Check to variable Object parameters - ObjectUtils.isAnyNull
> ----------------------------------------------------------------
>
>                 Key: LANG-781
>                 URL: https://issues.apache.org/jira/browse/LANG-781
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Sandro Lehmann
>            Priority: Minor
>              Labels: patch
>         Attachments: ObjectUtils.java.patch, ObjectUtilsTest.java.patch
>
>
> Sometimes it would be very comfortable, to test a few objects to null. Instead of writing if(obj1==null || obj2==null || ...), using a method like isAnyNull(obj1, obj2, ...) would be much better.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira