velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schu...@apache.org
Subject svn commit: r1151648 - in /velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view: LinkTool.java tools/LinkTool.java
Date Wed, 27 Jul 2011 22:10:11 GMT
Author: schultz
Date: Wed Jul 27 22:10:10 2011
New Revision: 1151648

URL: http://svn.apache.org/viewvc?rev=1151648&view=rev
Log:
Fixed VELTOOLS-149: LinkTool.addRequestParams methods are difficult to use from VTL due to
their String[] parameter type
- Changed method signatures to accept "Object..." instead of "String...".

Modified:
    velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/LinkTool.java
    velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/tools/LinkTool.java

Modified: velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/LinkTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/LinkTool.java?rev=1151648&r1=1151647&r2=1151648&view=diff
==============================================================================
--- velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/LinkTool.java
(original)
+++ velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/LinkTool.java
Wed Jul 27 22:10:10 2011
@@ -136,7 +136,7 @@ public class LinkTool extends org.apache
      * @return A LinkTool object with the specified parameters from
      *         the current request added to it or all the params if none specified.
      */
-    public LinkTool addRequestParams(String... butOnlyThese)
+    public LinkTool addRequestParams(Object... butOnlyThese)
     {
         return addRequestParams(false, butOnlyThese);
     }
@@ -148,7 +148,7 @@ public class LinkTool extends org.apache
      * @return A LinkTool object with all of the current request's parameters
      *         added to it, except those specified.
      */
-    public LinkTool addRequestParamsExcept(String... ignoreThese)
+    public LinkTool addRequestParamsExcept(Object... ignoreThese)
     {
         return addRequestParams(true, ignoreThese);
     }
@@ -162,13 +162,13 @@ public class LinkTool extends org.apache
      *         added to it, except those specified or those that already have
      *         values.
      */
-    public LinkTool addMissingRequestParams(String... ignoreThese)
+    public LinkTool addMissingRequestParams(Object... ignoreThese)
     {
-        String[] these;
+        Object[] these;
         if (query != null && !query.isEmpty())
         {
             Set keys = query.keySet();
-            these = new String[keys.size() + ignoreThese.length];
+            these = new Object[keys.size() + ignoreThese.length];
             int i = 0;
             for (; i < ignoreThese.length; i++)
             {
@@ -186,7 +186,7 @@ public class LinkTool extends org.apache
         return addRequestParams(true, these);
     }
 
-    private LinkTool addRequestParams(boolean ignore, String... special)
+    private LinkTool addRequestParams(boolean ignore, Object... special)
     {
         LinkTool copy = (LinkTool)duplicate(true);
         Map reqParams = request.getParameterMap();
@@ -207,9 +207,9 @@ public class LinkTool extends org.apache
         return copy;
     }
 
-    private boolean contains(String[] set, String name)
+    private boolean contains(Object[] set, String name)
     {
-        for (String i : set)
+        for (Object i : set)
         {
             if (name.equals(i))
             {

Modified: velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/tools/LinkTool.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/tools/LinkTool.java?rev=1151648&r1=1151647&r2=1151648&view=diff
==============================================================================
--- velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/tools/LinkTool.java
(original)
+++ velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/view/tools/LinkTool.java
Wed Jul 27 22:10:10 2011
@@ -249,7 +249,7 @@ public class LinkTool extends org.apache
     {
         if (this.parametersToIgnore != null)
         {
-            String[] ignoreThese = new String[parametersToIgnore.size()];
+            Object[] ignoreThese = new String[parametersToIgnore.size()];
             return (LinkTool)addRequestParamsExcept(parametersToIgnore.toArray(ignoreThese));
         }
         else if (autoIgnore)



Mime
View raw message