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

Dekel updated LANG-1435:
------------------------
    Description: 
Currently, if the default value in defaultIfNull is computationally slow (for 
example, it requires a database call, or complex calculations), it's not worth 
using the util method. This feature is to implement a method that would only 
perform this computationally slow action if the object value is actually null. 
This can be done using a Supplier.

In short, you'd call ObjectUtils.getDefaultIfNull(someNullableValue, 
DbUtil::doGet) instead of ObjectUtils.defaultIfNull(someNullableValue, 
DbUtil.doGet()) 

  was:
Currently, if the default value in defaultIfNull is computationally slow (for 
example, it requires a database call, or complex calculations), it's not worth 
using the util method. This feature is to implement a method that would only 
perform this computationally slow action if the object value is actually null. 
This can be done using a Supplier.

In short, you'd call ObjectUtils.defaultIfNull(someNullableValue, 
DbUtil::doGet) instead of ObjectUtils.defaultIfNull(someNullableValue, 
DbUtil.doGet()) 


> ObjectUtils.defaultIfNull for slow default values
> -------------------------------------------------
>
>                 Key: LANG-1435
>                 URL: https://issues.apache.org/jira/browse/LANG-1435
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Dekel
>            Priority: Minor
>   Original Estimate: 0.5h
>          Time Spent: 10m
>  Remaining Estimate: 20m
>
> Currently, if the default value in defaultIfNull is computationally slow (for 
> example, it requires a database call, or complex calculations), it's not 
> worth using the util method. This feature is to implement a method that would 
> only perform this computationally slow action if the object value is actually 
> null. This can be done using a Supplier.
> In short, you'd call ObjectUtils.getDefaultIfNull(someNullableValue, 
> DbUtil::doGet) instead of ObjectUtils.defaultIfNull(someNullableValue, 
> DbUtil.doGet()) 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to