You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jörg Gottschling (JIRA)" <ji...@apache.org> on 2007/10/12 08:27:51 UTC
[jira] Created: (LANG-358) ObjectUtils.coalesce
ObjectUtils.coalesce
--------------------
Key: LANG-358
URL: https://issues.apache.org/jira/browse/LANG-358
Project: Commons Lang
Issue Type: New Feature
Affects Versions: LangTwo 1.0
Reporter: Jörg Gottschling
Priority: Minor
I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
<T> T ObjectUtils.coalesce(T... t)
The first object, which is not null will be returned. I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
<T> T ObjectUtils.coalesce(T t1, T t2)
<T> T ObjectUtils.coalesce(T t1, T t2, T t3)
...
I would provide it, including tests, if you like.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (LANG-358) ObjectUtils.coalesce
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed LANG-358.
------------------------------
Resolution: Fixed
svn ci -m "Applying Jörg Gottschling's patch from LANG-358 with Thomas Menzel's naming from LANG-550 and some of his tests. This adds a firstNonNull method to ObjectUtils. " src
Sending src/java/org/apache/commons/lang/ObjectUtils.java
Sending src/test/org/apache/commons/lang/ObjectUtilsTest.java
Transmitting file data ..
Committed revision 833016.
> ObjectUtils.coalesce
> --------------------
>
> Key: LANG-358
> URL: https://issues.apache.org/jira/browse/LANG-358
> Project: Commons Lang
> Issue Type: New Feature
> Reporter: Jörg Gottschling
> Priority: Minor
> Fix For: 3.0
>
> Attachments: ObjectUtils.java, ObjectUtilsTest.java
>
>
> I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
> <T> T ObjectUtils.coalesce(T... t)
> The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/... methods, with al flexibler and shorter method. It will also reuse an existing name.
> I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
> <T> T ObjectUtils.coalesce(T t1, T t2)
> <T> T ObjectUtils.coalesce(T t1, T t2, T t3)
> ...
> I would provide it, including tests, if you like.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-358) ObjectUtils.coalesce
Posted by "Jörg Gottschling (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jörg Gottschling updated LANG-358:
----------------------------------
Attachment: ObjectUtilsTest.java
test for the method
> ObjectUtils.coalesce
> --------------------
>
> Key: LANG-358
> URL: https://issues.apache.org/jira/browse/LANG-358
> Project: Commons Lang
> Issue Type: New Feature
> Reporter: Jörg Gottschling
> Priority: Minor
> Fix For: LangTwo 1.0
>
> Attachments: ObjectUtils.java, ObjectUtilsTest.java
>
>
> I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
> <T> T ObjectUtils.coalesce(T... t)
> The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/... methods, with al flexibler and shorter method. It will also reuse an existing name.
> I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
> <T> T ObjectUtils.coalesce(T t1, T t2)
> <T> T ObjectUtils.coalesce(T t1, T t2, T t3)
> ...
> I would provide it, including tests, if you like.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-358) ObjectUtils.coalesce
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell updated LANG-358:
-------------------------------
Fix Version/s: LangTwo 1.0
Affects Version/s: (was: LangTwo 1.0)
> ObjectUtils.coalesce
> --------------------
>
> Key: LANG-358
> URL: https://issues.apache.org/jira/browse/LANG-358
> Project: Commons Lang
> Issue Type: New Feature
> Reporter: Jörg Gottschling
> Priority: Minor
> Fix For: LangTwo 1.0
>
>
> I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
> <T> T ObjectUtils.coalesce(T... t)
> The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/... methods, with al flexibler and shorter method. It will also reuse an existing name.
> I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
> <T> T ObjectUtils.coalesce(T t1, T t2)
> <T> T ObjectUtils.coalesce(T t1, T t2, T t3)
> ...
> I would provide it, including tests, if you like.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-358) ObjectUtils.coalesce
Posted by "Jörg Gottschling (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jörg Gottschling updated LANG-358:
----------------------------------
Attachment: ObjectUtils.java
trivial implementation of coalesce
> ObjectUtils.coalesce
> --------------------
>
> Key: LANG-358
> URL: https://issues.apache.org/jira/browse/LANG-358
> Project: Commons Lang
> Issue Type: New Feature
> Reporter: Jörg Gottschling
> Priority: Minor
> Fix For: LangTwo 1.0
>
> Attachments: ObjectUtils.java
>
>
> I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
> <T> T ObjectUtils.coalesce(T... t)
> The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/... methods, with al flexibler and shorter method. It will also reuse an existing name.
> I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
> <T> T ObjectUtils.coalesce(T t1, T t2)
> <T> T ObjectUtils.coalesce(T t1, T t2, T t3)
> ...
> I would provide it, including tests, if you like.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-358) ObjectUtils.coalesce
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742774#action_12742774 ]
Henri Yandell commented on LANG-358:
------------------------------------
Ponders coalesce vs 'firstNotNull'.
Interesting that the first doc I found on SQL coalesce uses firstNotNull as the label:
http://msdn.microsoft.com/en-us/library/ms190349.aspx
> ObjectUtils.coalesce
> --------------------
>
> Key: LANG-358
> URL: https://issues.apache.org/jira/browse/LANG-358
> Project: Commons Lang
> Issue Type: New Feature
> Reporter: Jörg Gottschling
> Priority: Minor
> Fix For: 3.0
>
> Attachments: ObjectUtils.java, ObjectUtilsTest.java
>
>
> I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
> <T> T ObjectUtils.coalesce(T... t)
> The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/... methods, with al flexibler and shorter method. It will also reuse an existing name.
> I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
> <T> T ObjectUtils.coalesce(T t1, T t2)
> <T> T ObjectUtils.coalesce(T t1, T t2, T t3)
> ...
> I would provide it, including tests, if you like.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-358) ObjectUtils.coalesce
Posted by "Jörg Gottschling (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jörg Gottschling updated LANG-358:
----------------------------------
Description:
I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
<T> T ObjectUtils.coalesce(T... t)
The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/... methods, with al flexibler and shorter method. It will also reuse an existing name.
I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
<T> T ObjectUtils.coalesce(T t1, T t2)
<T> T ObjectUtils.coalesce(T t1, T t2, T t3)
...
I would provide it, including tests, if you like.
was:
I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
<T> T ObjectUtils.coalesce(T... t)
The first object, which is not null will be returned. I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
<T> T ObjectUtils.coalesce(T t1, T t2)
<T> T ObjectUtils.coalesce(T t1, T t2, T t3)
...
I would provide it, including tests, if you like.
> ObjectUtils.coalesce
> --------------------
>
> Key: LANG-358
> URL: https://issues.apache.org/jira/browse/LANG-358
> Project: Commons Lang
> Issue Type: New Feature
> Affects Versions: LangTwo 1.0
> Reporter: Jörg Gottschling
> Priority: Minor
>
> I like to see the coalesce-function from SQL implemented in ObjectUtils. Something like this:
> <T> T ObjectUtils.coalesce(T... t)
> The first object, which is not null will be returned. This would replace all the defaultValue/defaultString/... methods, with al flexibler and shorter method. It will also reuse an existing name.
> I think it's simple. Perhaps there should be overloading methods with fixed parameter sizes. Following the jdk this seems to a little faster:
> <T> T ObjectUtils.coalesce(T t1, T t2)
> <T> T ObjectUtils.coalesce(T t1, T t2, T t3)
> ...
> I would provide it, including tests, if you like.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.