|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
org.apache.myfaces.trinidad.validator.RegExpValidator
@JSFValidator(configExcluded=true)
public class RegExpValidator
RegExpValidator is a Validator that checks the value of the corresponding component against specified pattern using Java regular expression syntax. The regular expression syntax accepted by the RegExpValidator class is same as mentioned in class Pattern in package java.util.regex. The following algorithm is implemented:
null, exit immediately.pattern property has been configured on this Validator, check the component value against this pattern. If value does not match pattern throw a ValidatorException containing a NO_MATCH_MESSAGE_ID message. If noMatchMessageDetail is set, it is used for constructing faces message. The message can contain placeholders which will be replaced as specified in NO_MATCH_MESSAGE_IDsetMessageDetailNoMatch(String)| Field Summary | |
|---|---|
static String |
NO_MATCH_MESSAGE_IDThe message identifier of the FacesMessage to be created if the match fails. |
static String |
VALIDATOR_IDStandard validator id for this validator. |
| Fields inherited from interface javax.faces.validator.Validator |
|---|
NOT_IN_RANGE_MESSAGE_ID |
| Constructor Summary | |
|---|---|
RegExpValidator()Construct a RegExpValidator with no preconfigured pattern. |
|
RegExpValidator(String pattern)Construct a RegExpValidator with preconfigured pattern. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object object)Compares this PatternValidator with the specified Object for equality. |
String |
getHint()Return custom hint message. |
String |
getMessageDetailNoMatch()Return custom detail error message that was set for creating faces message, for values that do not match the specified pattern. |
String |
getPattern()Return the pattern value to be enforced by this Validator |
javax.faces.el.ValueBinding |
getValueBinding(String name)Deprecated. |
javax.el.ValueExpression |
getValueExpression(String name)Return the ValueExpression used to calculate the value for the specified attribute name, if any. |
int |
hashCode()Returns the hash code for this Validator. |
boolean |
isDisabled()Return whether it is disabled. |
boolean |
isTransient() |
void |
restoreState(javax.faces.context.FacesContext context, Object state) |
Object |
saveState(javax.faces.context.FacesContext context) |
void |
setDisabled(boolean isDisabled)Return whether it is disabled. |
void |
setHint(String hintPattern)Custom hint message. |
void |
setMessageDetailNoMatch(String noMatchMessageDetail)Custom error message to be used, for creating detail part of the FacesMessage, when value does not match the specified pattern. |
void |
setPattern(String pattern)Set the pattern value to be enforced by this Validator |
void |
setTransient(boolean transientValue) |
void |
setValueBinding(String name, javax.faces.el.ValueBinding binding)Deprecated. |
void |
setValueExpression(String name, javax.el.ValueExpression expression)Set the ValueExpression used to calculate the value for the specified attribute if any. |
void |
validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value) |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String VALIDATOR_ID
Standard validator id for this validator.
public static final String NO_MATCH_MESSAGE_ID
The message identifier of the FacesMessage to be created if the match fails. The message format string for this message may optionally include a {0}, {1} and {4} placeholders, which will be replaced input value, label associated with the component and pattern respectively.
| Constructor Detail |
|---|
public RegExpValidator()
Construct a RegExpValidator with no preconfigured pattern.
public RegExpValidator(String pattern)
Construct a RegExpValidator with preconfigured pattern.
| Method Detail |
|---|
public void validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object value)
throws javax.faces.validator.ValidatorException
validate in interface javax.faces.validator.Validatorjavax.faces.validator.ValidatorException - if validation failsNullPointerException - if context or component or pattern is nullIllegalArgumentException - if value is not of type String
@JSFProperty(istransient=true,
tagExcluded=true)
public boolean isTransient()
isTransient in interface javax.faces.component.StateHolderpublic void setTransient(boolean transientValue)
setTransient in interface javax.faces.component.StateHolderpublic Object saveState(javax.faces.context.FacesContext context)
saveState in interface javax.faces.component.StateHolder
public void restoreState(javax.faces.context.FacesContext context,
Object state)
restoreState in interface javax.faces.component.StateHolder
public void setValueExpression(String name,
javax.el.ValueExpression expression)
Set the ValueExpression used to calculate the value for the specified attribute if any.
name - Name of the attribute for which to set a ValueExpressionexpression - The ValueExpression to set, or null to remove any currently set ValueExpressionNullPointerException - if name is nullIllegalArgumentException - if name is not a valid attribute of this converterpublic javax.el.ValueExpression getValueExpression(String name)
Return the ValueExpression used to calculate the value for the specified attribute name, if any.
name - Name of the attribute or property for which to retrieve a ValueExpressionNullPointerException - if name is nullIllegalArgumentException - if name is not a valid attribute of this converter
public void setValueBinding(String name,
javax.faces.el.ValueBinding binding)
Set the ValueBinding used to calculate the value for the specified attribute if any.
name - Name of the attribute for which to set a ValueBindingbinding - The ValueBinding to set, or null to remove any currently set ValueBindingNullPointerException - if name is nullIllegalArgumentException - if name is not a valid attribute of this validatorpublic javax.faces.el.ValueBinding getValueBinding(String name)
Return the ValueBinding used to calculate the value for the specified attribute name, if any.
name - Name of the attribute or property for which to retrieve a ValueBindingNullPointerException - if name is nullIllegalArgumentException - if name is not a valid attribute of this validatorpublic boolean equals(Object object)
Compares this PatternValidator with the specified Object for equality.
equals in class Objectobject - Object to which this PatternValidator is to be compared.public int hashCode()
Returns the hash code for this Validator.
hashCode in class Objectpublic void setHint(String hintPattern)
Custom hint message.
Overrides default hint messagehintPattern - Custom hint message.
@JSFProperty(tagExcluded=true)
public String getHint()
Return custom hint message.
setHint(String)public void setPattern(String pattern)
Set the pattern value to be enforced by this Validator
pattern - to be enforced.
@JSFProperty
public String getPattern()
Return the pattern value to be enforced by this Validator
public void setMessageDetailNoMatch(String noMatchMessageDetail)
Custom error message to be used, for creating detail part of the FacesMessage, when value does not match the specified pattern.
NO_MATCH_MESSAGE_IDnoMatchMessageDetail -
@JSFProperty
public String getMessageDetailNoMatch()
Return custom detail error message that was set for creating faces message, for values that do not match the specified pattern.
setMessageDetailNoMatch(String)public void setDisabled(boolean isDisabled)
public boolean isDisabled()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.