commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Scholte (JIRA)" <j...@apache.org>
Subject [jira] Updated: (LANG-422) StrBuilder appendSeparator with defaultIfEmpty
Date Fri, 11 Apr 2008 10:24:17 GMT

     [ 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.


Mime
View raw message