|
||||||||||
| 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
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 java.lang.String |
NO_MATCH_MESSAGE_IDThe message identifier of the FacesMessage to be created if the match fails. |
static java.lang.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(java.lang.String pattern)Construct a RegExpValidator with preconfigured pattern. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object object)Compares this PatternValidator with the specified Object for equality. |
java.lang.String |
getHint()Return custom hint message. |
java.lang.String |
getMessageDetailNoMatch()Return custom detail error message that was set for creating faces message, for values that do not match the specified pattern. |
java.lang.String |
getPattern()Return the pattern value to be enforced by this Validator |
javax.faces.el.ValueBinding |
getValueBinding(java.lang.String name)Deprecated. |
javax.el.ValueExpression |
getValueExpression(java.lang.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 |
isTransient() |
void |
restoreState(javax.faces.context.FacesContext context, java.lang.Object state) |
java.lang.Object |
saveState(javax.faces.context.FacesContext context) |
void |
setHint(java.lang.String hintPattern)Custom hint message. |
void |
setMessageDetailNoMatch(java.lang.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(java.lang.String pattern)Set the pattern value to be enforced by this Validator |
void |
setTransient(boolean transientValue) |
void |
setValueBinding(java.lang.String name, javax.faces.el.ValueBinding binding)Deprecated. |
void |
setValueExpression(java.lang.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, java.lang.Object value) |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String VALIDATOR_ID
Standard validator id for this validator.
public static final java.lang.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(java.lang.String pattern)
Construct a RegExpValidator with preconfigured pattern.
| Method Detail |
|---|
public void validate(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
throws javax.faces.validator.ValidatorException
validate in interface javax.faces.validator.Validatorjavax.faces.validator.ValidatorException - if validation failsjava.lang.NullPointerException - if context or component or pattern is nulljava.lang.IllegalArgumentException - if value is not of type Stringpublic boolean isTransient()
isTransient in interface javax.faces.component.StateHolderpublic void setTransient(boolean transientValue)
setTransient in interface javax.faces.component.StateHolderpublic java.lang.Object saveState(javax.faces.context.FacesContext context)
saveState in interface javax.faces.component.StateHolder
public void restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
restoreState in interface javax.faces.component.StateHolder
public void setValueExpression(java.lang.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 ValueExpressionjava.lang.NullPointerException - if name is nulljava.lang.IllegalArgumentException - if name is not a valid attribute of this converterpublic javax.el.ValueExpression getValueExpression(java.lang.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 ValueExpressionjava.lang.NullPointerException - if name is nulljava.lang.IllegalArgumentException - if name is not a valid attribute of this converter
public void setValueBinding(java.lang.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 ValueBindingjava.lang.NullPointerException - if name is nulljava.lang.IllegalArgumentException - if name is not a valid attribute of this validatorpublic javax.faces.el.ValueBinding getValueBinding(java.lang.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 ValueBindingjava.lang.NullPointerException - if name is nulljava.lang.IllegalArgumentException - if name is not a valid attribute of this validatorpublic boolean equals(java.lang.Object object)
Compares this PatternValidator with the specified Object for equality.
equals in class java.lang.Objectobject - Object to which this PatternValidator is to be compared.public int hashCode()
Returns the hash code for this Validator.
hashCode in class java.lang.Objectpublic void setHint(java.lang.String hintPattern)
Custom hint message.
Overrides default hint messagehintPattern - Custom hint message.public java.lang.String getHint()
Return custom hint message.
setHint(String)public void setPattern(java.lang.String pattern)
Set the pattern value to be enforced by this Validator
pattern - to be enforced.public java.lang.String getPattern()
Return the pattern value to be enforced by this Validator
public void setMessageDetailNoMatch(java.lang.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 -public java.lang.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)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.