oracle.adf.view.faces.validator
Class RegExpValidator

java.lang.Object
  |
  +--oracle.adf.view.faces.validator.PatternValidator
        |
        +--oracle.adf.view.faces.validator.RegExpValidator
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

public class RegExpValidator
extends PatternValidator

RegExpValidator is a Validator that checks the value of the corresponding component against specified pattern using Java regular expression syntax. The regular expression syntax accepted by the Validator is same as mentioned in class Pattern in package java.util.regex. The following algorithm is implemented:


Field Summary
static java.lang.String INVALID_FORMAT_MESSAGE_ID
          The message identifier of the FacesMessage to be created, if syntax of pattern is invalid.
static java.lang.String NO_MATCH_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the match fails.
static java.lang.String TYPE_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the current value of this component is not of the correct type.
static java.lang.String VALIDATOR_ID
          Standard validator id for this validator.
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
RegExpValidator()
          Construct a Validator with no preconfigured pattern.
RegExpValidator(java.lang.String pattern)
          Construct a Validator with preconfigured pattern.
 
Method Summary
 void setPattern(java.lang.String pattern)
          

Set the pattern value to be enforced by this Validator

 void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
           
 
Methods inherited from class oracle.adf.view.faces.validator.PatternValidator
equals, getPattern, hashCode, isTransient, restoreState, saveState, setTransient
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final java.lang.String VALIDATOR_ID

Standard validator id for this validator.

See Also:
Constant Field Values

INVALID_FORMAT_MESSAGE_ID

public static final java.lang.String INVALID_FORMAT_MESSAGE_ID

The message identifier of the FacesMessage to be created, if syntax of pattern is invalid. The message format string for this message may optionally include a {0} placeholder, which will be replaced by the pattern that was set in the validator.

See Also:
Constant Field Values

NO_MATCH_MESSAGE_ID

public static final java.lang.String NO_MATCH_MESSAGE_ID

The message identifier of the FacesMessage to be created if the match fails. The message format string for this message may optionally include a {0} placeholder, which will be replaced by value that was set in input component and {1} which will be replaced by the pattern set in the validator.

See Also:
Constant Field Values

TYPE_MESSAGE_ID

public static final java.lang.String TYPE_MESSAGE_ID

The message identifier of the FacesMessage to be created if the current value of this component is not of the correct type.

See Also:
Constant Field Values
Constructor Detail

RegExpValidator

public RegExpValidator()

Construct a Validator with no preconfigured pattern.


RegExpValidator

public RegExpValidator(java.lang.String pattern)

Construct a Validator with preconfigured pattern.

Method Detail

validate

public void validate(javax.faces.context.FacesContext context,
                     javax.faces.component.UIComponent component,
                     java.lang.Object value)
              throws javax.faces.validator.ValidatorException
Throws:
javax.faces.validator.ValidatorException - if validation fails
java.lang.NullPointerException - if context or component or pattern is null

setPattern

public void setPattern(java.lang.String pattern)

Set the pattern value to be enforced by this Validator

Overrides:
setPattern in class PatternValidator
Parameters:
pattern - to be enforced.


Copyright © 2003-2004 Oracle Corporation. All Rights Reserved.