public class ValidationContextImpl extends java.lang.Object implements ValidationContext
Constructor and Description |
---|
ValidationContextImpl(java.lang.String command,
Property property,
java.util.Map<java.lang.String,Property[]> properties,
BindContext ctx,
boolean valid) |
Modifier and Type | Method and Description |
---|---|
BindContext |
getBindContext() |
java.lang.String |
getCommand()
get the command that trigger the validation
|
java.util.Map<java.lang.String,Property[]> |
getProperties()
get dependent properties that need to be validated.
|
java.util.Map<java.lang.String,Property> |
getProperties(java.lang.Object base)
get dependent properties by a base object.
|
Property[] |
getProperties(java.lang.String name)
get dependent properties by the property name.
|
Property |
getProperty()
get the main property that need to be validated.
|
java.lang.Object |
getValidatorArg(java.lang.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 ValidationContextImpl(java.lang.String command, Property property, java.util.Map<java.lang.String,Property[]> properties, BindContext ctx, boolean valid)
public BindContext getBindContext()
getBindContext
in interface ValidationContext
public java.lang.String getCommand()
ValidationContext
getCommand
in interface ValidationContext
public java.util.Map<java.lang.String,Property[]> getProperties()
ValidationContext
getProperties
in interface ValidationContext
public Property[] getProperties(java.lang.String name)
ValidationContext
getProperties
in interface ValidationContext
name
- the property namepublic java.util.Map<java.lang.String,Property> getProperties(java.lang.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 ValidationContext
base
- the base object of propertiespublic java.lang.Object getValidatorArg(java.lang.String key)
ValidationContext
getBindContext().getValidatorArg()
getValidatorArg
in interface ValidationContext
key
- the key to the value.public Property getProperty()
ValidationContext
getProperty
in interface ValidationContext
public boolean isValid()
ValidationContext
ValidationContext.setInvalid()
will set this false.isValid
in interface ValidationContext
Validator
called ValidationContext.setInvalid()
. Note, default is true.public boolean isLocalValid()
ValidationContext
isLocalValid
in interface ValidationContext
Validator
called ValidationContext.setInvalid()
, default is true.public void setInvalid()
ValidationContext
setInvalid
in interface ValidationContext
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.