You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by ve...@jakarta.apache.org on 2004/12/08 22:41:55 UTC
[Jakarta-Velocity Wiki] Updated: EscapeTool
Date: 2004-12-08T13:41:55
Editor: ShinobuKawai <sh...@ieee.org>
Wiki: Jakarta-Velocity Wiki
Page: EscapeTool
URL: http://wiki.apache.org/jakarta-velocity/EscapeTool
Allow Object parameters.
Change Log:
------------------------------------------------------------------------------
@@ -92,14 +92,18 @@
* <br />
* Delegates the process to {@link StringEscapeUtils#escapeJava(String)}.
*
- * @param java String to escape values in, may be null
+ * @param string the string to escape values, may be null
* @return String with escaped values, <code>null</code> if null string input
*
* @see StringEscapeUtils#escapeJava(String)
*/
- public String java(String java)
+ public String java(Object string)
{
- return StringEscapeUtils.escapeJava(java);
+ if (string == null)
+ {
+ return null;
+ }
+ return StringEscapeUtils.escapeJava(String.valueOf(string));
}
/**
@@ -107,14 +111,18 @@
* <br />
* Delegates the process to {@link StringEscapeUtils#escapeJavaScript(String)}.
*
- * @param javascript String to escape values in, may be null
+ * @param string the string to escape values, may be null
* @return String with escaped values, <code>null</code> if null string input
*
* @see StringEscapeUtils#escapeJavaScript(String)
*/
- public String javascript(String javascript)
+ public String javascript(Object string)
{
- return StringEscapeUtils.escapeJavaScript(javascript);
+ if (string == null)
+ {
+ return null;
+ }
+ return StringEscapeUtils.escapeJavaScript(String.valueOf(string));
}
/**
@@ -122,14 +130,18 @@
* <br />
* Delegates the process to {@link StringEscapeUtils#escapeHtml(String)}.
*
- * @param html the <code>String</code> to escape, may be null
+ * @param string the string to escape, may be null
* @return a new escaped <code>String</code>, <code>null</code> if null string input
*
* @see StringEscapeUtils#escapeHtml(String)
*/
- public String html(String html)
+ public String html(Object string)
{
- return StringEscapeUtils.escapeHtml(html);
+ if (string == null)
+ {
+ return null;
+ }
+ return StringEscapeUtils.escapeHtml(String.valueOf(string));
}
/**
@@ -137,14 +149,18 @@
* <br />
* Delegates the process to {@link StringEscapeUtils#escapeXml(String)}.
*
- * @param xml the <code>String</code> to escape, may be null
+ * @param string the string to escape, may be null
* @return a new escaped <code>String</code>, <code>null</code> if null string input
*
* @see StringEscapeUtils#escapeXml(String)
*/
- public String xml(String xml)
+ public String xml(Object string)
{
- return StringEscapeUtils.escapeXml(xml);
+ if (string == null)
+ {
+ return null;
+ }
+ return StringEscapeUtils.escapeXml(String.valueOf(string));
}
/**
@@ -152,14 +168,18 @@
* <br />
* Delegates the process to {@link StringEscapeUtils#escapeSql(String)}.
*
- * @param sql the string to escape, may be null
+ * @param string the string to escape, may be null
* @return a new String, escaped for SQL, <code>null</code> if null string input
*
* @see StringEscapeUtils#escapeSql(String)
*/
- public String sql(String sql)
+ public String sql(Object string)
{
- return StringEscapeUtils.escapeSql(sql);
+ if (string == null)
+ {
+ return null;
+ }
+ return StringEscapeUtils.escapeSql(String.valueOf(string));
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org