You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Robert Scholte (JIRA)" <ji...@apache.org> on 2008/04/08 12:41:24 UTC

[jira] Created: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty

StrBuilder appendSeparator with defaultIfEmpty
----------------------------------------------

                 Key: LANG-422
                 URL: https://issues.apache.org/jira/browse/LANG-422
             Project: Commons Lang
          Issue Type: Improvement
    Affects Versions: 2.4
            Reporter: Robert Scholte
            Priority: Minor
             Fix For: 3.0


If would like to suggest the following method for the StrBuilder class:

*appendSeparator(String separator, String defaultIfEmpty)*

it's usage is very handy for building queries (a much more I guess)
{code}
StrBuilder whereClause = new StrBuilder();
if(searchCommand.priority != null) {
  whereClause.appendSeparator(" and", " where");
  whereClause.append(" priority = ?")
}
if(searchCommand.component != null) {
  whereClause.appendSeparator(" and", " where");
  whereClause.append(" component = ?")
}

// if(!whereClause.isEmpty()) {
// selectClause.append(" where")
// selectClause.append(whereClause)
//}
selectClause.append(whereClause)

{code}

this can be done for every queryClause (eliminating all isEmpty-checks), but there are usefull usecases


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


[jira] Issue Comment Edited: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587071#action_12587071 ] 

rfscholte-getthere edited comment on LANG-422 at 4/9/08 2:41 AM:
-------------------------------------------------------------

No worries, I'll write this stuff.

But which of the appendSeparators should support defaultIfEmpty?
I guess only the (String) and (Char) -methods, not the looping-ones.

      was (Author: rfscholte-getthere):
    No worries, I'll write this stuff.
  
> StrBuilder appendSeparator with defaultIfEmpty
> ----------------------------------------------
>
>                 Key: LANG-422
>                 URL: https://issues.apache.org/jira/browse/LANG-422
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Minor
>             Fix For: 3.0
>
>
> If would like to suggest the following method for the StrBuilder class:
> *appendSeparator(String separator, String defaultIfEmpty)*
> it's usage is very handy for building queries (a much more I guess)
> {code}
> StrBuilder whereClause = new StrBuilder();
> if(searchCommand.priority != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" priority = ?")
> }
> if(searchCommand.component != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" component = ?")
> }
> // if(!whereClause.isEmpty()) {
> // selectClause.append(" where")
> // selectClause.append(whereClause)
> //}
> selectClause.append(whereClause)
> {code}
> this can be done for every queryClause (eliminating all isEmpty-checks), but there are usefull usecases

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


[jira] Commented: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587071#action_12587071 ] 

Robert Scholte commented on LANG-422:
-------------------------------------

No worries, I'll write this stuff.

> StrBuilder appendSeparator with defaultIfEmpty
> ----------------------------------------------
>
>                 Key: LANG-422
>                 URL: https://issues.apache.org/jira/browse/LANG-422
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Minor
>             Fix For: 3.0
>
>
> If would like to suggest the following method for the StrBuilder class:
> *appendSeparator(String separator, String defaultIfEmpty)*
> it's usage is very handy for building queries (a much more I guess)
> {code}
> StrBuilder whereClause = new StrBuilder();
> if(searchCommand.priority != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" priority = ?")
> }
> if(searchCommand.component != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" component = ?")
> }
> // if(!whereClause.isEmpty()) {
> // selectClause.append(" where")
> // selectClause.append(whereClause)
> //}
> selectClause.append(whereClause)
> {code}
> this can be done for every queryClause (eliminating all isEmpty-checks), but there are usefull usecases

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


[jira] Closed: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-422.
------------------------------

    Resolution: Fixed

Patch applied in:

r826969 | bayard | 2009-10-19 23:10:10 -0700 (Mon, 19 Oct 2009) | 1 line
Changed paths:
   M /commons/proper/lang/trunk/src/java/org/apache/commons/lang/text/StrBuilder.java
   M /commons/proper/lang/trunk/src/test/org/apache/commons/lang/text/StrBuilderAppendInsertTest.java

Applying Robert Scholte's patch from LANG-422, adding a appendSeparator with an alternative default separator if the StrBuilder is currently empty

> StrBuilder appendSeparator with defaultIfEmpty
> ----------------------------------------------
>
>                 Key: LANG-422
>                 URL: https://issues.apache.org/jira/browse/LANG-422
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-422-RS.patch
>
>
> If would like to suggest the following method for the StrBuilder class:
> *appendSeparator(String separator, String defaultIfEmpty)*
> it's usage is very handy for building queries (a much more I guess)
> {code}
> StrBuilder whereClause = new StrBuilder();
> if(searchCommand.priority != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" priority = ?")
> }
> if(searchCommand.component != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" component = ?")
> }
> // if(!whereClause.isEmpty()) {
> // selectClause.append(" where")
> // selectClause.append(whereClause)
> //}
> selectClause.append(whereClause)
> {code}
> this can be done for every queryClause (eliminating all isEmpty-checks), but there are usefull usecases

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


[jira] Commented: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587049#action_12587049 ] 

Henri Yandell commented on LANG-422:
------------------------------------

Seems good to me.  Unit test and code patch anyone?

> StrBuilder appendSeparator with defaultIfEmpty
> ----------------------------------------------
>
>                 Key: LANG-422
>                 URL: https://issues.apache.org/jira/browse/LANG-422
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Minor
>             Fix For: 3.0
>
>
> If would like to suggest the following method for the StrBuilder class:
> *appendSeparator(String separator, String defaultIfEmpty)*
> it's usage is very handy for building queries (a much more I guess)
> {code}
> StrBuilder whereClause = new StrBuilder();
> if(searchCommand.priority != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" priority = ?")
> }
> if(searchCommand.component != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" component = ?")
> }
> // if(!whereClause.isEmpty()) {
> // selectClause.append(" where")
> // selectClause.append(whereClause)
> //}
> selectClause.append(whereClause)
> {code}
> this can be done for every queryClause (eliminating all isEmpty-checks), but there are usefull usecases

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


[jira] Updated: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-422:
---------------------------------

    Fix Version/s:     (was: 3.0)
                   2.5

> StrBuilder appendSeparator with defaultIfEmpty
> ----------------------------------------------
>
>                 Key: LANG-422
>                 URL: https://issues.apache.org/jira/browse/LANG-422
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.text.*
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Minor
>             Fix For: 2.5
>
>         Attachments: LANG-422-RS.patch
>
>
> If would like to suggest the following method for the StrBuilder class:
> *appendSeparator(String separator, String defaultIfEmpty)*
> it's usage is very handy for building queries (a much more I guess)
> {code}
> StrBuilder whereClause = new StrBuilder();
> if(searchCommand.priority != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" priority = ?")
> }
> if(searchCommand.component != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" component = ?")
> }
> // if(!whereClause.isEmpty()) {
> // selectClause.append(" where")
> // selectClause.append(whereClause)
> //}
> selectClause.append(whereClause)
> {code}
> this can be done for every queryClause (eliminating all isEmpty-checks), but there are usefull usecases

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


[jira] Updated: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty

Posted by "Robert Scholte (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Scholte updated LANG-422:
--------------------------------

    Attachment: LANG-422-RS.patch

patch for StrBuilder.appendSeparator(String, String) and StrBuilder.appendSeparator(char, char)
includes also the corresponding tests

> StrBuilder appendSeparator with defaultIfEmpty
> ----------------------------------------------
>
>                 Key: LANG-422
>                 URL: https://issues.apache.org/jira/browse/LANG-422
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.4
>            Reporter: Robert Scholte
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: LANG-422-RS.patch
>
>
> If would like to suggest the following method for the StrBuilder class:
> *appendSeparator(String separator, String defaultIfEmpty)*
> it's usage is very handy for building queries (a much more I guess)
> {code}
> StrBuilder whereClause = new StrBuilder();
> if(searchCommand.priority != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" priority = ?")
> }
> if(searchCommand.component != null) {
>   whereClause.appendSeparator(" and", " where");
>   whereClause.append(" component = ?")
> }
> // if(!whereClause.isEmpty()) {
> // selectClause.append(" where")
> // selectClause.append(whereClause)
> //}
> selectClause.append(whereClause)
> {code}
> this can be done for every queryClause (eliminating all isEmpty-checks), but there are usefull usecases

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