commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From britter <...@git.apache.org>
Subject [GitHub] commons-lang pull request #213: LANG-1288: Add a builder to StringEscapeUtil...
Date Tue, 22 Nov 2016 19:30:30 GMT
Github user britter commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/213#discussion_r89192411
  
    --- 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;
    +        private final CharSequenceTranslator translator;
    +
    +        public Builder(final CharSequenceTranslator translator) {
    --- End diff --
    
    This is true for `BasicThreadFactory.Builder` which has to be constructed using the default
constructor (yiaks) but not for `TypeUtils.WildcardTypeBuilder` which has static factory methods
and a private constructor. I prefer the latter approach.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message