IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

com.ibm.btt.rcp.xui.validator
Class NumberPatternValidator

java.lang.Object
  extended by com.ibm.btt.rcp.xui.validator.Validator
      extended by com.ibm.btt.rcp.xui.validator.AbstractRegexValidator
          extended by com.ibm.btt.rcp.xui.validator.NumberPatternValidator
All Implemented Interfaces:
IValidator

public class NumberPatternValidator
extends AbstractRegexValidator

The input can only be as the pattern specified. This format of the pattern is ¡®##-##-##¡¯. The ¡®#¡¯ stands for a number.


Constructor Summary
NumberPatternValidator()
           
 
Method Summary
 java.lang.String getFormat()
          Get the format of number pattern
 java.lang.String getRegex()
          Get regex string which validate based on
 void setFormat(java.lang.String format)
          Set the format of number pattern
 java.lang.String validate(IXUIWidget source, java.lang.String value)
          Summary: Validates any sort of number based format Description: Use it for phone numbers, social security numbers, zip-codes, etc.
 
Methods inherited from class com.ibm.btt.rcp.xui.validator.Validator
getErrorMessage, setErrorMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberPatternValidator

public NumberPatternValidator()
Method Detail

validate

public java.lang.String validate(IXUIWidget source,
                                 java.lang.String value)
Summary:

Validates any sort of number based format

Description:

Use it for phone numbers, social security numbers, zip-codes, etc. The value can be validated against one format or one of multiple formats.

Format
    #        Stands for a digit, 0-9.
    ?        Stands for an optional digit, 0-9 or nothing.
    All other characters must appear literally in the expression.
  
Example
   
    "(###) ###-####"       ->   (510) 542-9742
    "(###) ###-#### x#???" ->   (510) 542-9742 x153
    "###-##-####"          ->   506-82-1089       i.e. social security number
    "#####-####"           ->   98225-1649        i.e. zip code
  
value: A string
flags: {format:String}
flags.format A string or an Array of strings for multiple formats.

Specified by:
validate in interface IValidator
Overrides:
validate in class AbstractRegexValidator
Returns:

getRegex

public java.lang.String getRegex()
Description copied from class: AbstractRegexValidator
Get regex string which validate based on

Specified by:
getRegex in class AbstractRegexValidator
Returns:

getFormat

public java.lang.String getFormat()
Get the format of number pattern

Returns:

setFormat

public void setFormat(java.lang.String format)
Set the format of number pattern

Parameters:
format -

IBM WebSphere Multichannel Bank Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2010