|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springjutsu.validation.rules.ValidationRule
public class ValidationRule
Java representation of an XML validation rule.
| Field Summary | |
|---|---|
protected CollectionStrategy |
collectionStrategy
Indicates whether the rule should be applied to individual collection members, or to the collection object itself. |
protected String |
errorPath
The path on which the error should be written on the @link{Errors} object. |
protected List<String> |
formConstraints
A list of form mappings, if provided, the rule will only execute when the specified form(s) is/are loaded. |
protected String |
message
An optional message code which may be used to resolve a non-default error message (a message other than that which is coded for the rule executor). |
protected String |
path
Path to the field to validate. |
protected List<ValidationRule> |
rules
These are any validation rules that were nested within the current rule in XML. |
protected List<ValidationTemplateReference> |
templateReferences
These are any validation template references that were nested within the current rule in XML. |
protected String |
type
Name of the rule executor, implies the type of rule to apply. |
protected String |
value
This is the argument to be passed to the rule executor. |
| Constructor Summary | |
|---|---|
ValidationRule(String path,
String type,
String value)
Default constructor, utilized by @link{ValidationDefinitionParser} |
|
| Method Summary | |
|---|---|
void |
addFormConstraint(String form)
|
void |
addRule(ValidationRule rule)
Adds a rule to the nested validation rules. |
void |
addTemplateReference(ValidationTemplateReference templateReference)
Adds a template ref to the nested validation template references. |
boolean |
appliesToForm(String form)
Returns true if the rule applies to the current form. |
void |
applyBasePathReplacement(String oldBasePath,
String newBasePath)
Replaces a base path within this and any sub rules. |
ValidationRule |
clone()
Straight up clone. |
ValidationRule |
cloneWithBasePath(String basePath)
Clones this validation rule but with a different base path Used within validation logic of @link{ValidationManager} The base path is also applied to all sub rules recursively. |
ValidationRule |
cloneWithPath(String path)
Clones this validation rule but with a different path Used within validation logic of @link{ValidationManager} |
CollectionStrategy |
getCollectionStrategy()
|
String |
getErrorPath()
|
List<String> |
getFormConstraints()
|
String |
getMessage()
|
String |
getPath()
|
List<ValidationRule> |
getRules()
|
List<ValidationTemplateReference> |
getTemplateReferences()
|
String |
getType()
|
String |
getValue()
|
boolean |
hasChildren()
|
void |
setCollectionStrategy(CollectionStrategy collectionStrategy)
|
void |
setErrorPath(String errorPath)
|
void |
setFormConstraints(List<String> formConstraints)
|
void |
setMessage(String message)
|
void |
setPath(String path)
|
void |
setRules(List<ValidationRule> rules)
|
void |
setTemplateReferences(List<ValidationTemplateReference> templateReferences)
|
void |
setType(String type)
|
void |
setValue(String value)
|
String |
toString()
The toString() representation is a reconstruction of the XML syntax of the validation rule, minus any nested validation rules. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String path
protected String type
protected String value
protected String message
protected String errorPath
protected CollectionStrategy collectionStrategy
protected List<String> formConstraints
protected List<ValidationRule> rules
protected List<ValidationTemplateReference> templateReferences
| Constructor Detail |
|---|
public ValidationRule(String path,
String type,
String value)
path - See path docs.type - See type docs.value - See value docs.| Method Detail |
|---|
public ValidationRule clone()
clone in class Objectpublic ValidationRule cloneWithPath(String path)
path - The new path to apply to the cloned rule
public ValidationRule cloneWithBasePath(String basePath)
path - The new path to apply to the cloned rule
public void applyBasePathReplacement(String oldBasePath,
String newBasePath)
oldBasePath - the old base path to replacenewBasePath - the new base path to applypublic boolean hasChildren()
public String toString()
toString in class Objectpublic boolean appliesToForm(String form)
public void addFormConstraint(String form)
public void addRule(ValidationRule rule)
rule - The rule to add.public void addTemplateReference(ValidationTemplateReference templateReference)
templateReference - The template reference to add.public String getPath()
public void setPath(String path)
path - the path to setpublic String getType()
public void setType(String type)
type - the type to set.public String getValue()
public void setValue(String value)
value - the value / argument to setpublic List<ValidationRule> getRules()
public void setRules(List<ValidationRule> rules)
rules - the rules to setpublic String getMessage()
public void setMessage(String message)
message - the message to setpublic String getErrorPath()
public void setErrorPath(String errorPath)
errorPath - the errorPath to setpublic CollectionStrategy getCollectionStrategy()
public void setCollectionStrategy(CollectionStrategy collectionStrategy)
public List<String> getFormConstraints()
public void setFormConstraints(List<String> formConstraints)
public List<ValidationTemplateReference> getTemplateReferences()
public void setTemplateReferences(List<ValidationTemplateReference> templateReferences)
templateReferences - the templateReferences to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||