org.apache.myfaces.commons.validator
Class ValidatorBase

java.lang.Object
  extended by org.apache.myfaces.commons.validator.ValidatorBase
All Implemented Interfaces:
EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator
Direct Known Subclasses:
AbstractCompareToValidator, AbstractCreditCardValidator, AbstractCSVValidator, AbstractRegExprValidator, AbstractUrlValidator, EmailValidator, ISBNValidator

@JSFValidator(configExcluded=true,
              evaluateELOnExecution=true,
              tagClass="org.apache.myfaces.commons.validator.ValidatorBaseTag",
              tagHandler="org.apache.myfaces.commons.validator.ValidatorBaseTagHandler")
public abstract class ValidatorBase
extends Object
implements javax.faces.component.StateHolder, javax.faces.validator.Validator

Base validator implementation for Apache MyFaces Commons Validators.


Field Summary
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
ValidatorBase()
           
 
Method Summary
 String getDetailMessage()
          alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively)
protected  javax.faces.context.FacesContext getFacesContext()
           
protected  javax.faces.application.FacesMessage getFacesMessage(String defaultMessage, Object[] args)
           
 String getMessage()
          Deprecated. Use getDetailMessage()
protected  String getStringValue(javax.faces.context.FacesContext context, javax.faces.el.ValueBinding vb)
           
 String getSummaryMessage()
          alternate validation error summary message format string
 javax.faces.el.ValueBinding getValueBinding(String name)
           
 boolean isTransient()
           
static Object restoreAttachedState(javax.faces.context.FacesContext context, Object stateObj)
           
 void restoreState(javax.faces.context.FacesContext context, Object state)
           
static Object saveAttachedState(javax.faces.context.FacesContext context, Object attachedObject)
          Serializes objects which are "attached" to this component but which are not UIComponent children of it.
 Object saveState(javax.faces.context.FacesContext context)
           
 void setDetailMessage(String message)
           
 void setMessage(String message)
          Deprecated. Use setDetailMessage()
 void setSummaryMessage(String message)
           
 void setTransient(boolean newTransientValue)
           
 void setValueBinding(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
 

Constructor Detail

ValidatorBase

public ValidatorBase()
Method Detail

getSummaryMessage

@JSFProperty
public String getSummaryMessage()
alternate validation error summary message format string

Returns:
The summary message to be displayed

setSummaryMessage

public void setSummaryMessage(String message)
Parameters:
message - The summary message to be displayed.

getMessage

@JSFProperty
public String getMessage()
Deprecated. Use getDetailMessage()

alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively)

Returns:
The message.

setMessage

public void setMessage(String message)
Deprecated. Use setDetailMessage()

Parameters:
message - The detail message to be displayed.

getDetailMessage

@JSFProperty
public String getDetailMessage()
alternate validation error detail message format string (use 'message' and 'detailMessage' alternatively)

Returns:
The detail message.

setDetailMessage

public void setDetailMessage(String message)
Parameters:
message - The detail message to be displayed.

saveState

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

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         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

getFacesMessage

protected javax.faces.application.FacesMessage getFacesMessage(String defaultMessage,
                                                               Object[] args)
Parameters:
defaultMessage - The default message we would expect.
args - Arguments for parsing this message.
Returns:
FacesMessage

getValueBinding

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

setValueBinding

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

saveAttachedState

public static Object saveAttachedState(javax.faces.context.FacesContext context,
                                       Object attachedObject)
Serializes objects which are "attached" to this component but which are not UIComponent children of it. Examples are validator and listener objects. To be precise, it returns an object which implements java.io.Serializable, and which when serialized will persist the state of the provided object.

If the attachedObject is a List then every object in the list is saved via a call to this method, and the returned wrapper object contains a List object.

If the object implements StateHolder then the object's saveState is called immediately, and a wrapper is returned which contains both this saved state and the original class name. However in the case where the StateHolder.isTransient method returns true, null is returned instead.

If the object implements java.io.Serializable then the object is simply returned immediately; standard java serialization will later be used to store this object.

In all other cases, a wrapper is returned which simply stores the type of the provided object. When deserialized, a default instance of that type will be recreated.


restoreAttachedState

public static Object restoreAttachedState(javax.faces.context.FacesContext context,
                                          Object stateObj)
                                   throws IllegalStateException
Throws:
IllegalStateException

getFacesContext

protected javax.faces.context.FacesContext getFacesContext()

getStringValue

protected String getStringValue(javax.faces.context.FacesContext context,
                                javax.faces.el.ValueBinding vb)


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.