org.books.view.component
Class RegexValidator

java.lang.Object
  extended by org.books.view.component.RegexValidator
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

public class RegexValidator
extends java.lang.Object
implements javax.faces.validator.Validator, javax.faces.component.StateHolder

CAS Enterprise Application Development mit Java EE (EADJ) - 2007
Modul: Web-Tier (JSF)
Uebung: 10 (Custom Validator and Converter Tags)
Beschreibung:
Diese Klasse implementiert einen Validator fuer Reulaere Ausdruecke.

Copyright (c) 2007 bouquet dot ch, 3032 Hinterkappelen. All rights reseved.

Version:
1.0 - 11.05.2007
Author:
Marc Bouquet ( marc at bouquet dot ch, Switzerland )
See Also:
@link{javax.faces.validator.Validator}, @link{javax.faces.component.StateHolder}

Field Summary
static java.lang.String VALIDATOR_ID
          The identifier of the validator.
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
RegexValidator()
           
 
Method Summary
 boolean isTransient()
          Returns the transient value.
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
          Restores the state of the validator.
 java.lang.Object saveState(javax.faces.context.FacesContext context)
          Saves the state of the validator.
 void setPattern(java.lang.String pattern)
          Sets the pattern of the regular expression.
 void setTransient(boolean value)
          Sets the transient value.
 void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
          Validates a text against the regular expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final java.lang.String VALIDATOR_ID
The identifier of the validator.

See Also:
Constant Field Values
Constructor Detail

RegexValidator

public RegexValidator()
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
Validates a text against the regular expression.

Specified by:
validate in interface javax.faces.validator.Validator
Parameters:
context - FacesContext FacesContext the faces context
component - UIComponent UIComponent the component
value - Object
Throws:
javax.faces.validator.ValidatorException

isTransient

public boolean isTransient()
Returns the transient value.

Specified by:
isTransient in interface javax.faces.component.StateHolder
Returns:
boolean

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Saves the state of the validator.

Specified by:
saveState in interface javax.faces.component.StateHolder
Parameters:
context - FacesContext FacesContext the faces context
Returns:
Object

setTransient

public void setTransient(boolean value)
Sets the transient value.

Specified by:
setTransient in interface javax.faces.component.StateHolder
Parameters:
value - boolean

setPattern

public void setPattern(java.lang.String pattern)
Sets the pattern of the regular expression.

Parameters:
pattern - String

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Restores the state of the validator.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Parameters:
context - context FacesContext FacesContext the faces context
state - Object


Copyright © 2007 - bouquet dot ch, 3032 Hinterkappelen. All Rights Reserved.