Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 51512 invoked from network); 8 Mar 2011 05:20:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Mar 2011 05:20:35 -0000 Received: (qmail 84218 invoked by uid 500); 8 Mar 2011 05:20:35 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 84132 invoked by uid 500); 8 Mar 2011 05:20:34 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 84120 invoked by uid 99); 8 Mar 2011 05:20:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 05:20:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Mar 2011 05:20:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 34DD82388A19; Tue, 8 Mar 2011 05:20:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1079169 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java Date: Tue, 08 Mar 2011 05:20:13 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110308052013.34DD82388A19@eris.apache.org> Author: bayard Date: Tue Mar 8 05:20:12 2011 New Revision: 1079169 URL: http://svn.apache.org/viewvc?rev=1079169&view=rev Log: Adding Javadoc to public constants - LANG-682 Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java?rev=1079169&r1=1079168&r2=1079169&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java Tue Mar 8 05:20:12 2011 @@ -50,6 +50,13 @@ public class StringEscapeUtils { /* ESCAPE TRANSLATORS */ + /** + * Translator object for escaping Java. + * + * While {@link escapeJava(String)} is the expected method of use, this + * object allows the Java escaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator ESCAPE_JAVA = new LookupTranslator( new String[][] { @@ -61,6 +68,13 @@ public class StringEscapeUtils { UnicodeEscaper.outsideOf(32, 0x7f) ); + /** + * Translator object for escaping EcmaScript/JavaScript. + * + * While {@link escapeEcmaScript(String)} is the expected method of use, this + * object allows the EcmaScript escaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator ESCAPE_ECMASCRIPT = new AggregateTranslator( new LookupTranslator( @@ -74,18 +88,39 @@ public class StringEscapeUtils { UnicodeEscaper.outsideOf(32, 0x7f) ); + /** + * Translator object for escaping XML. + * + * While {@link escapeXml(String)} is the expected method of use, this + * object allows the XML escaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator ESCAPE_XML = new AggregateTranslator( new LookupTranslator(EntityArrays.BASIC_ESCAPE()), new LookupTranslator(EntityArrays.APOS_ESCAPE()) ); + /** + * Translator object for escaping HTML version 3.0. + * + * While {@link escapeHtml3(String)} is the expected method of use, this + * object allows the HTML escaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator ESCAPE_HTML3 = new AggregateTranslator( new LookupTranslator(EntityArrays.BASIC_ESCAPE()), new LookupTranslator(EntityArrays.ISO8859_1_ESCAPE()) ); + /** + * Translator object for escaping HTML version 4.0. + * + * While {@link escapeHtml4(String)} is the expected method of use, this + * object allows the HTML escaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator ESCAPE_HTML4 = new AggregateTranslator( new LookupTranslator(EntityArrays.BASIC_ESCAPE()), @@ -93,6 +128,13 @@ public class StringEscapeUtils { new LookupTranslator(EntityArrays.HTML40_EXTENDED_ESCAPE()) ); + /** + * Translator object for escaping individual Comma Separated Values. + * + * While {@link escapeCsv(String)} is the expected method of use, this + * object allows the CSV escaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator ESCAPE_CSV = new CsvEscaper(); // TODO: Create a parent class - 'SinglePassTranslator' ? @@ -126,6 +168,13 @@ public class StringEscapeUtils { /* UNESCAPE TRANSLATORS */ + /** + * Translator object for unescaping escaped Java. + * + * While {@link unescapeJava(String)} is the expected method of use, this + * object allows the Java unescaping functionality to be used + * as the foundation for a custom translator. + */ // TODO: throw "illegal character: \92" as an Exception if a \ on the end of the Java (as per the compiler)? public static final CharSequenceTranslator UNESCAPE_JAVA = new AggregateTranslator( @@ -141,8 +190,22 @@ public class StringEscapeUtils { }) ); + /** + * Translator object for unescaping escaped EcmaScript. + * + * While {@link unescapeEcmaScript(String)} is the expected method of use, this + * object allows the EcmaScript unescaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator UNESCAPE_ECMASCRIPT = UNESCAPE_JAVA; + /** + * Translator object for unescaping escaped HTML 3.0. + * + * While {@link unescapeHtml3(String)} is the expected method of use, this + * object allows the HTML unescaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator UNESCAPE_HTML3 = new AggregateTranslator( new LookupTranslator(EntityArrays.BASIC_UNESCAPE()), @@ -150,6 +213,13 @@ public class StringEscapeUtils { new NumericEntityUnescaper() ); + /** + * Translator object for unescaping escaped HTML 4.0. + * + * While {@link unescapeHtml4(String)} is the expected method of use, this + * object allows the HTML unescaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator UNESCAPE_HTML4 = new AggregateTranslator( new LookupTranslator(EntityArrays.BASIC_UNESCAPE()), @@ -158,6 +228,13 @@ public class StringEscapeUtils { new NumericEntityUnescaper() ); + /** + * Translator object for unescaping escaped XML. + * + * While {@link unescapeXml(String)} is the expected method of use, this + * object allows the XML unescaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator UNESCAPE_XML = new AggregateTranslator( new LookupTranslator(EntityArrays.BASIC_UNESCAPE()), @@ -165,6 +242,13 @@ public class StringEscapeUtils { new NumericEntityUnescaper() ); + /** + * Translator object for unescaping escaped Comma Separated Value entries. + * + * While {@link unescapeCsv(String)} is the expected method of use, this + * object allows the CSV unescaping functionality to be used + * as the foundation for a custom translator. + */ public static final CharSequenceTranslator UNESCAPE_CSV = new CsvUnescaper(); static class CsvUnescaper extends CharSequenceTranslator { @@ -385,7 +469,9 @@ public class StringEscapeUtils { * Does not support DTDs or external entities.

* *

Note that unicode characters greater than 0x7f are as of 3.0, no longer - * escaped.

+ * escaped. If you still wish this functionality, you can achieve it + * via the following: + * {@code StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.above(0x7f) );}

* * @param input the {@code String} to escape, may be null * @return a new escaped {@code String}, {@code null} if null string input