|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shale.validator.util.AbstractUtilities
org.apache.shale.validator.validator.AbstractValidator
public abstract class AbstractValidator
Abstract base class for validators that use Apache Commons Validator as their foundation.
| Field Summary | |
|---|---|
protected static java.lang.String |
ARG_VALUE
Variable name in a vars map representing the argument
that was being evaluated, and should be included in any error message. |
protected static org.apache.shale.util.ConverterHelper |
helper
Converter helper instance we can use in the convert()
method implementation. |
protected static java.lang.String |
MAXIMUM_VALUE
Variable name in a vars map representing the maximum
value that should be accepted by this Validator. |
protected static java.lang.String |
MINIMUM_VALUE
Variable name in a vars map representing the minimum
value that should be accepted by this Validator. |
protected static java.lang.String |
SUBMITTED_VALUE
Variable name in a vars map representing the submitted
value that should be validated by this Validator. |
| Fields inherited from class org.apache.shale.validator.util.AbstractUtilities |
|---|
DEFAULT_RESOURCE_BUNDLE |
| Fields inherited from interface javax.faces.validator.Validator |
|---|
NOT_IN_RANGE_MESSAGE_ID |
| Constructor Summary | |
|---|---|
AbstractValidator()
|
|
| Method Summary | |
|---|---|
protected ShaleValidatorAction[] |
actions(javax.faces.context.FacesContext context,
java.lang.String type)
Return an array of ShaleValidatorActions to execute
for a given validation, starting with the configured dependent
actions, and ending with the action corresponding to the specified
action type. |
protected java.lang.Object |
convert(javax.faces.context.FacesContext context,
java.lang.Object value,
java.lang.Class type)
Use the registered converters to convert the specified value to the specified type. |
boolean |
isClient()
Return a flag describing whether this validator should be enforced on the client side or not. |
protected org.apache.commons.validator.ValidatorResources |
resources(javax.faces.context.FacesContext context)
Return the ValidatorResources that describe the
validation rules to be enforced by this application. |
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
|
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
|
void |
setClient(boolean client)
Set a flag describing whether this validator should be enforced on the client side or not. |
abstract void |
validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
Perform the correctness checks implemented by this Validator against the specified UIComponent. |
protected void |
validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value,
java.lang.String type,
java.util.Map vars)
Perform a validation using the specified Commons Validator type. |
| Methods inherited from class org.apache.shale.validator.util.AbstractUtilities |
|---|
getMessage, isTransient, message, message, message, setMessage, setTransient |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String ARG_VALUE
Variable name in a vars map representing the argument
that was being evaluated, and should be included in any error message.
Typically, this will be either the value itself or a user-friendly
(localized) field label.
protected static final java.lang.String MAXIMUM_VALUE
Variable name in a vars map representing the maximum
value that should be accepted by this Validator.
protected static final java.lang.String MINIMUM_VALUE
Variable name in a vars map representing the minimum
value that should be accepted by this Validator.
protected static final java.lang.String SUBMITTED_VALUE
Variable name in a vars map representing the submitted
value that should be validated by this Validator.
protected static final org.apache.shale.util.ConverterHelper helper
Converter helper instance we can use in the convert()
method implementation.
| Constructor Detail |
|---|
public AbstractValidator()
| Method Detail |
|---|
public boolean isClient()
Return a flag describing whether this validator should be enforced
on the client side or not. Default is true.
public void setClient(boolean client)
Set a flag describing whether this validator should be enforced on the client side or not.
client - The new client enforcement flag
public abstract void validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
throws javax.faces.validator.ValidatorException
Perform the correctness checks implemented by this
Validator against the specified UIComponent.
If any violations are found, a ValidatorException
will be thrown containing the FacesMessage
describing the failure.
IMPLEMENTATION NOTE: Unlike earlier implementations of Shale Validator integration, validators that subclass this class do not support the option to skip server side validation.
validate in interface javax.faces.validator.Validatorcontext - FacesContext for the current requestcomponent - UIComponent we are checking for correctnessvalue - The value to validate
javax.faces.validator.ValidatorException - if validation fails
java.lang.NullPointerException - if context
or component is null
public void restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
restoreState in interface javax.faces.component.StateHolderrestoreState in class AbstractUtilitiespublic java.lang.Object saveState(javax.faces.context.FacesContext context)
saveState in interface javax.faces.component.StateHoldersaveState in class AbstractUtilities
protected ShaleValidatorAction[] actions(javax.faces.context.FacesContext context,
java.lang.String type)
Return an array of ShaleValidatorActions to execute
for a given validation, starting with the configured dependent
actions, and ending with the action corresponding to the specified
action type. If there is no defined action with the specified
type, return null.
context - FacesContext for the current requesttype - Type of the validator action for which to return actions
protected java.lang.Object convert(javax.faces.context.FacesContext context,
java.lang.Object value,
java.lang.Class type)
Use the registered converters to convert the specified value to the specified type.
context - FacesContext for the current requestvalue - Value to be convertedtype - Type to which the value should be convertedprotected org.apache.commons.validator.ValidatorResources resources(javax.faces.context.FacesContext context)
Return the ValidatorResources that describe the
validation rules to be enforced by this application.
context - FacesContext for the current request
protected void validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value,
java.lang.String type,
java.util.Map vars)
throws javax.faces.validator.ValidatorException
Perform a validation using the specified Commons Validator type.
context - FacesContext for the current requestcomponent - UIComponent whose value is being validatedvalue - The value being validatedtype - Type of validation to be performedvars - Mutable map of values to be passed in to the validation
javax.faces.validator.ValidatorException - if a validation error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||