Date: 2004-12-08T13:41:55
   Editor: ShinobuKawai <[EMAIL PROTECTED]>
   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 [EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
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 [EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to