Commits

Anonymous committed 28be58d

XW-623:
Change MULTI_TEXTVALUE_SPARATOR into a property configurable by injection of constant named xwork.validatorfileparser.multi_textvalue_separator

git-svn-id: http://svn.opensymphony.com/svn/xwork/branches/2.0@1861e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 4761a3f
  • Branches 2.0, xwork_2_0_7

Comments (0)

Files changed (2)

File src/java/com/opensymphony/xwork2/validator/ValidatorFileParser.java

 package com.opensymphony.xwork2.validator;
 
 import com.opensymphony.xwork2.ObjectFactory;
-import com.opensymphony.xwork2.util.DomHelper;
 import com.opensymphony.xwork2.XWorkException;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.DomHelper;
 import org.w3c.dom.*;
 import org.xml.sax.InputSource;
 
  */
 public class ValidatorFileParser {
 
-    static final String MULTI_TEXTVALUE_SEPARATOR = " ";
+    static final String DEFAULT_MULTI_TEXTVALUE_SEPARATOR = " ";
+    static final String MULTI_TEXTVALUE_SEPARATOR_CONFIG_KEY = "xwork.validatorfileparser.multi_textvalue_separator";
+
+    static String multiTextvalueSeparator=DEFAULT_MULTI_TEXTVALUE_SEPARATOR;
+
+    @Inject(value=MULTI_TEXTVALUE_SEPARATOR_CONFIG_KEY, required = false)
+    public static void setMultiTextvalueSeparator(String type) {
+        multiTextvalueSeparator = type;
+    }
+
+    public static String getMultiTextvalueSeparator() {
+        return multiTextvalueSeparator;
+    }
 
     /**
      * Parse resource for a list of ValidatorConfig objects.
                 final String nodeValue = item.getNodeValue();
                 if (nodeValue != null) {
                     if (firstCDataFound) {
-                        value.append(MULTI_TEXTVALUE_SEPARATOR);
+                        value.append(getMultiTextvalueSeparator());
                     } else {
                         firstCDataFound = true;
                     }

File src/java/xwork-default.xml

     <!--  static injections -->
     <bean class="com.opensymphony.xwork2.util.OgnlValueStack" static="true" />
     <bean class="com.opensymphony.xwork2.util.XWorkConverter" static="true" />
-    
+    <bean class="com.opensymphony.xwork2.validator.ValidatorFileParser" static="true" />
+
     <package name="xwork-default">
     	
     	<!-- START SNIPPET: xwork2-default-result-types -->