org.apache.myfaces.validator
Class ValidatorBase

java.lang.Object
  extended by org.apache.myfaces.validator.ValidatorBase
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator
Direct Known Subclasses:
CreditCardValidator, EmailValidator, EqualValidator, RegExprValidator

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

ValidatorBase provides common attributes and behavior common to all Tomahawk and sandbox validators. Currently this includes: - getValueBinding(), setValueBinding(), and getFacesContext() methods available in UIComponentBase. - a message attribute which can be used to override the message key on a per-validator instance. A validator subclass should call getMessage(), and, if not null, use this message key instead. A validator subclass must call super.saveState() and super.restoreState() so that the common attributes are persisted.

Version:
$Revision: 388575 $
Author:
mkienenb (latest modification by $Author: mkienenb $)

Field Summary
protected  java.lang.String _message
           
protected  boolean _transient
           
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
ValidatorBase()
           
 
Method Summary
protected  javax.faces.context.FacesContext getFacesContext()
           
 java.lang.String getMessage()
           
 javax.faces.el.ValueBinding getValueBinding(java.lang.String name)
           
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setMessage(java.lang.String message)
           
 void setTransient(boolean newTransientValue)
           
 void setValueBinding(java.lang.String name, javax.faces.el.ValueBinding binding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.validator.Validator
validate
 

Field Detail

_message

protected java.lang.String _message

_transient

protected boolean _transient
Constructor Detail

ValidatorBase

public ValidatorBase()
Method Detail

getMessage

public java.lang.String getMessage()

setMessage

public void setMessage(java.lang.String message)

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder

getValueBinding

public javax.faces.el.ValueBinding getValueBinding(java.lang.String name)

setValueBinding

public void setValueBinding(java.lang.String name,
                            javax.faces.el.ValueBinding binding)

getFacesContext

protected javax.faces.context.FacesContext getFacesContext()


Copyright 2006 Apache Software Foundation. All Rights Reserved.