Package org.zkoss.bind
Interface ValidationContext
-
- All Known Implementing Classes:
ValidationContextImpl
public interface ValidationContext
The context for validation- Since:
- 6.0.0
- Author:
- dennis
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BindContext
getBindContext()
java.lang.String
getCommand()
get the command that trigger the validationjava.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 ofgetBindContext().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 callsetInvalid()
will set this false.void
setInvalid()
set invalid
-
-
-
Method Detail
-
isValid
boolean isValid()
Checks status of validation context valid or not, it is a global status of same command, any validator of this validation phase callsetInvalid()
will set this false.- Returns:
- true of result is valid, false if any
Validator
calledsetInvalid()
. Note, default is true.
-
isLocalValid
boolean isLocalValid()
Checks status of local validation context valid or not, it only relates to one validator.- Returns:
- true of result is valid, false if this
Validator
calledsetInvalid()
, default is true. - Since:
- 6.5.3
-
setInvalid
void setInvalid()
set invalid
-
getCommand
java.lang.String getCommand()
get the command that trigger the validation- Returns:
- the command, null if a prompt-save-binding
-
getProperties
java.util.Map<java.lang.String,Property[]> getProperties()
get dependent properties that need to be validated. you usually use this method to get value of other properties to do complex validation or a form validation Notice that if the property is under a collection, you would see "$each", which represents "each"- Returns:
- the properties map.
-
getProperties
Property[] getProperties(java.lang.String name)
get dependent properties by the property name. you usually use this method to get a value of other properties to do complex validation or a form validation Notice that if the property is under a collection, you would see "$each", which represents "each"- Parameters:
name
- the property name- Returns:
- the properties array
-
getProperties
java.util.Map<java.lang.String,Property> getProperties(java.lang.Object base)
get dependent properties by a base object. this method returns a Map (key is the property name) of properties that have same base object. It is useful in the form validation case to get all dependent property that related to a form. For example in a validator of a form,
Notice that if the property is under a collection, you would see "$each", which represents "each"Map<String,Property> beanProps = ctx.getProperties(ctx.getProperty().getBase()); Map<String,Property> formProps = ctx.getProperties(ctx.getProperty().getValue());
- Parameters:
base
- the base object of properties- Returns:
- a Map of properties that has same base object.
- Since:
- 6.0.1
-
getValidatorArg
java.lang.Object getValidatorArg(java.lang.String key)
Returns validator arg value of the given key This is a shortcut ofgetBindContext().getValidatorArg()
- Parameters:
key
- the key to the value.- Returns:
- value of validator arg of the given key
- Since:
- 6.0.1
-
getProperty
Property getProperty()
get the main property that need to be validated. Notice that if the property is under a collection, you would see "$each", which represents "each"- Returns:
- the main property.
-
getBindContext
BindContext getBindContext()
- Returns:
- current bind context
-
-