You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2007/11/12 21:15:04 UTC

svn commit: r594282 - /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java

Author: nbubna
Date: Mon Nov 12 12:15:04 2007
New Revision: 594282

URL: http://svn.apache.org/viewvc?rev=594282&view=rev
Log:
make ValueParser respect deprecationSupportMode property w/regard to subkeys

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java?rev=594282&r1=594281&r2=594282&view=diff
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java (original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java Mon Nov 12 12:15:04 2007
@@ -79,6 +79,43 @@
         return this.source;
     }
 
+    /**
+     * Are subkeys allowed ?
+     * @return yes/no
+     */
+    protected boolean getAllowSubkeys()
+    {
+        return allowSubkeys;
+    }
+
+    /**
+     * allow or disallow subkeys
+     * @param allow
+     */
+    protected void setAllowSubkeys(boolean allow)
+    {
+        allowSubkeys = allow;
+    }
+
+    /**
+     * Does the actual configuration. This is protected, so
+     * subclasses may share the same ValueParser and call configure
+     * at any time, while preventing templates from doing so when 
+     * configure(Map) is locked.
+     */
+    protected void configure(ValueParser values)
+    {
+        super.configure(values);
+
+        // if we're supporting 1.x behavior
+        Boolean depMode = values.getBoolean("deprecationSupportMode");
+        if (depMode != null && depMode.booleanValue())
+        {
+            // then don't allow subkeys
+            setAllowSubkeys(false);
+        }
+    }
+
     // ----------------- public parsing methods --------------------------
 
     /**
@@ -383,24 +420,6 @@
     public Locale[] getLocales(String key)
     {
         return toLocales(getValues(key));
-    }
-
-    /**
-     * Are subkeys allowed ?
-     * @return yes/no
-     */
-    protected boolean getAllowSubkeys()
-    {
-        return allowSubkeys;
-    }
-
-    /**
-     * allow or disallow subkeys
-     * @param allow
-     */
-    protected void setAllowSubkeys(boolean allow)
-    {
-        allowSubkeys = allow;
     }
 
     /**