View Javadoc

1   /*
2    * $Id: AlphaFilter.java,v 1.1 2007/11/29 12:58:13 oeuillot Exp $
3    */
4   package org.rcfaces.core.internal.validator.impl;
5   
6   import org.apache.commons.logging.Log;
7   import org.apache.commons.logging.LogFactory;
8   import org.rcfaces.core.internal.lang.StringAppender;
9   import org.rcfaces.core.validator.IClientValidatorContext;
10  
11  /**
12   * 
13   * @author Olivier Oeuillot (latest modification by $Author: oeuillot $)
14   * @version $Revision: 1.1 $ $Date: 2007/11/29 12:58:13 $
15   */
16  public class AlphaFilter extends AbstractDynamicPatternTask {
17      private static final String REVISION = "$Revision: 1.1 $";
18  
19      private static final Log LOG = LogFactory.getLog(AlphaFilter.class);
20  
21      protected String getRegularExpression(IClientValidatorContext context) {
22  
23          StringAppender exp = new StringAppender("[", 16);
24  
25          appendRegExp(exp);
26  
27          String sup = getParameter(context, "alpha.otherChars");
28          if (sup != null && sup.length() > 0) {
29              exp.append(buildEscaped(sup));
30          }
31  
32          exp.append(']');
33  
34          return exp.toString();
35      }
36  
37      protected void appendRegExp(StringAppender sa) {
38          sa.append("a-zA-Z");
39      }
40  
41  }