public class ValidationContextImpl extends Object implements ValidationContext
| Constructor and Description |
|---|
ValidationContextImpl(String command,
Property property,
Map<String,Property[]> properties,
BindContext ctx,
boolean valid) |
| Modifier and Type | Method and Description |
|---|---|
BindContext |
getBindContext() |
String |
getCommand()
get the command that trigger the validation
|
Map<String,Property[]> |
getProperties()
get dependent properties that need to be validated.
|
Map<String,Property> |
getProperties(Object base)
get dependent properties by a base object.
|
Property[] |
getProperties(String name)
get dependent properties by the property name.
|
Property |
getProperty()
get the main property that need to be validated.
|
Object |
getValidatorArg(String key)
Returns validator arg value of the given key
This is a shortcut of
getBindContext().getValidatorArg() |
boolean |
isLocalValid()
Checks status of local validation context valid or not, it only relates to one validator.
|
boolean |
isValid()
Checks status of validation context valid or not, it is a global status of same command,
any validator of this validation phase call
ValidationContext.setInvalid() will set this false. |
void |
setInvalid()
set invalid
|
public BindContext getBindContext()
getBindContext in interface ValidationContextpublic String getCommand()
ValidationContextgetCommand in interface ValidationContextpublic Map<String,Property[]> getProperties()
ValidationContextgetProperties in interface ValidationContextpublic Property[] getProperties(String name)
ValidationContextgetProperties in interface ValidationContextname - the property namepublic Map<String,Property> getProperties(Object base)
ValidationContext
Map beanProps = ctx.getProperties(ctx.getProperty().getBase());
Map formProps = ctx.getProperties(ctx.getProperty().getValue());
Notice that if the property is under a collection, you would see "$each", which represents "each"getProperties in interface ValidationContextbase - the base object of propertiespublic Object getValidatorArg(String key)
ValidationContextgetBindContext().getValidatorArg()getValidatorArg in interface ValidationContextkey - the key to the value.public Property getProperty()
ValidationContextgetProperty in interface ValidationContextpublic boolean isValid()
ValidationContextValidationContext.setInvalid() will set this false.isValid in interface ValidationContextValidator called ValidationContext.setInvalid(). Note, default is true.public boolean isLocalValid()
ValidationContextisLocalValid in interface ValidationContextValidator called ValidationContext.setInvalid(), default is true.public void setInvalid()
ValidationContextsetInvalid in interface ValidationContextCopyright © 2020. All rights reserved.