public class ComponentValidators
extends java.lang.Object
This class is responsible for adding default validators and/or validators
that wrap multiple EditableValueHolder
instances within the view.
Modifier and Type | Class and Description |
---|---|
static class |
ComponentValidators.ValidatorInfo
Generic information container for a validator at a particular
nesting Level.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
COMPONENT_VALIDATORS
Key within the
FacesContext 's attribute map under which
a single ComponentValidators instance will be stored. |
private java.util.LinkedList<ComponentValidators.ValidatorInfo> |
validatorStack
Stack of
ValidatorInfo |
Constructor and Description |
---|
ComponentValidators() |
Modifier and Type | Method and Description |
---|---|
static void |
addDefaultValidatorsToComponent(javax.faces.context.FacesContext ctx,
javax.faces.component.EditableValueHolder editableValueHolder)
Creates and installs default validators, if any, into the argument
EditableValueHolder . |
void |
addValidators(javax.faces.context.FacesContext ctx,
javax.faces.component.EditableValueHolder editableValueHolder)
Based on the
ValidatorInfo instances present on the stack,
configure the argument EditableValueHolder with Validator s
created from the available info. |
private static void |
addValidatorsToComponent(javax.faces.context.FacesContext ctx,
java.util.Collection<java.lang.String> validatorIds,
javax.faces.component.EditableValueHolder editableValueHolder,
java.util.LinkedList<ComponentValidators.ValidatorInfo> validatorStack)
Install the validators, if not already present on the component,
using the IDs included in
validatorIds . |
static ComponentValidators |
getValidators(javax.faces.context.FacesContext context,
boolean createIfNull) |
void |
popValidatorInfo()
Pops the last
ValidatorInfo instance from the stack. |
void |
pushValidatorInfo(ComponentValidators.ValidatorInfo info)
Pushes the provided
ValidatorInfo onto the stack. |
private static final java.lang.String COMPONENT_VALIDATORS
FacesContext
's attribute map under which
a single ComponentValidators
instance will be stored.private java.util.LinkedList<ComponentValidators.ValidatorInfo> validatorStack
ValidatorInfo instances. Each instance represents
a particular nesting level within the view. As a nesting level is encountered,
a ValidatorInfo
will be pushed to the stack and all
EditableValueHolder
instances will be configured based on
all ValidatorInfo
s on the stack. When the current nesting level
is closed, the ValidatorInfo
instance will be popped and thus
have no impact on other EditableValueHolder
s.
public static ComponentValidators getValidators(javax.faces.context.FacesContext context, boolean createIfNull)
context
- the FacesContext
for the current requestcreateIfNull
- flag indicating whether or not a
ComponentValidators
instance should be created or notComponentValidators
instance for processing
a view request. If createIfNull
is false
and no ComponentValidators
has been created, this method
will return null
public static void addDefaultValidatorsToComponent(javax.faces.context.FacesContext ctx, javax.faces.component.EditableValueHolder editableValueHolder)
Creates and installs default validators, if any, into the argument
EditableValueHolder
. This method is merely a utility
method to be called when there is no ComponentValidators
available, or there are no ValidatorInfo
instances on the
stack.
ctx
- the FacesContext
for the current requesteditableValueHolder
- the component receiving the Validator
spublic void addValidators(javax.faces.context.FacesContext ctx, javax.faces.component.EditableValueHolder editableValueHolder)
Based on the ValidatorInfo
instances present on the stack,
configure the argument EditableValueHolder
with Validator
s
created from the available info.
ctx
- the FacesContext
for the current requesteditableValueHolder
- the component receiving the Validator
spublic void pushValidatorInfo(ComponentValidators.ValidatorInfo info)
Pushes the provided ValidatorInfo
onto the stack.
info
- public void popValidatorInfo()
Pops the last ValidatorInfo
instance from the stack.
private static void addValidatorsToComponent(javax.faces.context.FacesContext ctx, java.util.Collection<java.lang.String> validatorIds, javax.faces.component.EditableValueHolder editableValueHolder, java.util.LinkedList<ComponentValidators.ValidatorInfo> validatorStack)
Install the validators, if not already present on the component,
using the IDs included in validatorIds
.
ctx
- the FacesContext
for the current requestvalidatorIds
- the validator IDs to be added to the
EditableValueHolder
editableValueHolder
- the target component to which the validators
installedvalidatorStack
- current stack of ValidatorInfo instancesCopyright © 2002-2013 Oracle America, Inc. All Rights Reserved.