commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1288) Add a builder to StringEscapeUtils
Date Sun, 20 Nov 2016 15:06:58 GMT

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

ASF GitHub Bot commented on LANG-1288:
--------------------------------------

Github user PascalSchumacher commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/213#discussion_r88803456
  
    --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java ---
    @@ -429,6 +429,65 @@ public StringEscapeUtils() {
           super();
         }
     
    +    /**
    +     * <p>Convenience wrapper for {@link java.lang.StringBuilder} providing escape
methods.</p>
    +     *
    +     * <p>Example:</p>
    +     * <pre>
    +     * new Builder(ESCAPE_HTML4)
    +     *      .append("&lt;p>")
    +     *      .escape("This is paragraph 1 and special chars like &amp; get escaped.")
    +     *      .append("&lt;/p>&lt;p>")
    +     *      .escape("This is paragraph 2 &amp; more...")
    +     *      .append("&lt;/p>")
    +     *      .toString()
    +     * </pre>
    +     * 
    +     * @since 3.6
    +     */
    +    public static class Builder {
    +
    +        private final StringBuilder sb;
    --- End diff --
    
    The problem with `Appendable` is that its `append` method can throw an `IOException`.
That would make the builder more cumbersome to use. Of course it could just rethrow the `IOException`
as a `RuntimeException`, but I do not know if this is o.k. for commons-lang.


> Add a builder to StringEscapeUtils
> ----------------------------------
>
>                 Key: LANG-1288
>                 URL: https://issues.apache.org/jira/browse/LANG-1288
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Pascal Schumacher
>            Priority: Minor
>
> supplied in patch for LANG-1066



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message