lucee.Component
cbvalidation.ValidationManager
| Property Summary | ||||
|---|---|---|---|---|
| type | property | default | serializable | required |
any
|
resourceService
A resource bundle plugin for i18n capabilities.
|
true
|
false
|
|
struct
|
sharedConstraints
Shared constraints that can be loaded into the validation manager.
|
true
|
false
|
|
any
|
wirebox
WireBox Object Factory.
|
true
|
false
|
|
| Constructor Summary | |
|---|---|
|
init([struct sharedConstraints='[runtime expression]'])
Constructor. |
|
| Method Summary | |
|---|---|
IValidationManager
|
addSharedConstraint(string name, struct constraint)
Store a shared constraint. |
private struct
|
determineConstraintsDefinition(any target, [any constraints=''])
Determine from where to take the constraints from. |
private struct
|
discoverConstraints(any target)
Get the constraints structure from target objects, if none, it returns an empty structure. |
string
|
getResourceService()
|
struct
|
getSharedConstraints([string name])
Retrieve the shared constraints, all of them or by name. |
cbvalidation.models.validators.IValidator
|
getValidator(string validatorType, any validationData)
Create validators according to types and validation data. |
string
|
getWirebox()
|
ValidationManager
|
processRules(cbvalidation.models.result.ivalidationresult results, struct rules, any target, any field)
Process validation rules on a target object and field. |
any
|
setResourceService(any resourceService)
|
IValidationManager
|
setSharedConstraints([struct constraints])
Set the entire shared constraints structure. |
any
|
setWirebox(any wirebox)
|
boolean
|
sharedConstraintsExists(string name)
Check if a shared constraint exists by name. |
cbvalidation.IValidationResult
|
validate(any target, [string fields='*'], [any constraints=''], [string locale=''], [string excludeFields=''], [string includeFields=''])
Validate an object using constraints. |
| Methods inherited from class lucee.Component |
|---|
| None |
| Constructor Detail |
|---|
Constructor
sharedConstraints - A structure of shared constraints| Property Detail |
|---|
A resource bundle plugin for i18n capabilities
access - publicrequired - falsereturntype - anyinject - ResourceService@cbi18nserializable - trueShared constraints that can be loaded into the validation manager
access - publicrequired - falsereturntype - anyserializable - trueWireBox Object Factory
access - publicrequired - falsereturntype - anyinject - wireboxserializable - true| Method Detail |
|---|
Store a shared constraint
addSharedConstraint
in interface
IValidationManager
name - Filter by name or notconstraint - The constraint to store.Determine from where to take the constraints from
target - The target objectconstraints - The constraints rulesGet the constraints structure from target objects, if none, it returns an empty structure
target - The target objectRetrieve the shared constraints, all of them or by name
getSharedConstraints
in interface
IValidationManager
name - Filter by name or notCreate validators according to types and validation data
validatorType - The type of validator to retrieve, either internal or class path or wirebox IDvalidationData - The validation data that is used for custom validatorsProcess validation rules on a target object and field
results - The validation result objectrules - The structure containing validation rulestarget - The target object to do validation onfield - The field to validateresourceServiceSet the entire shared constraints structure
setSharedConstraints
in interface
IValidationManager
constraints - Filter by name or notwireboxCheck if a shared constraint exists by name
sharedConstraintsExists
in interface
IValidationManager
name - The shared constraint to checkValidate an object using constraints
validate
in interface
IValidationManager
target - The target object to validate or a structure like a form or collection. If it is a collection, we will build a generic object for you so we can validate the structure of name-value pairs.fields - One or more fields to validate on, by default it validates all fields in the constraints. This can be a simple list or an array.constraints - An optional shared constraints name or an actual structure of constraints to validate on.locale - An optional locale to use for i18n messagesexcludeFields - An optional list of fields to exclude from the validation.includeFields - An optional list of fields to include in the validation.