|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 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 String |
MAXIMUM_VALUE
Variable name in a vars map representing the maximum
value that should be accepted by this Validator . |
protected static String |
MINIMUM_VALUE
Variable name in a vars map representing the minimum
value that should be accepted by this Validator . |
protected static 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,
String type)
Return an array of ShaleValidatorAction s to execute
for a given validation, starting with the configured dependent
actions, and ending with the action corresponding to the specified
action type. |
protected Object |
convert(javax.faces.context.FacesContext context,
Object value,
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 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,
Object state)
|
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,
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,
Object value,
String type,
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 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 String MAXIMUM_VALUE
Variable name in a vars
map representing the maximum
value that should be accepted by this Validator
.
protected static final String MINIMUM_VALUE
Variable name in a vars
map representing the minimum
value that should be accepted by this Validator
.
protected static final 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 flagpublic abstract void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, 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.Validator
context
- FacesContext
for the current requestcomponent
- UIComponent
we are checking for correctnessvalue
- The value to validate
javax.faces.validator.ValidatorException
- if validation fails
NullPointerException
- if context
or component
is null
public void restoreState(javax.faces.context.FacesContext context, Object state)
restoreState
in interface javax.faces.component.StateHolder
restoreState
in class AbstractUtilities
public Object saveState(javax.faces.context.FacesContext context)
saveState
in interface javax.faces.component.StateHolder
saveState
in class AbstractUtilities
protected ShaleValidatorAction[] actions(javax.faces.context.FacesContext context, String type)
Return an array of ShaleValidatorAction
s 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 actionsprotected Object convert(javax.faces.context.FacesContext context, Object value, 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 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 requestprotected void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value, String type, 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 |