Usage
Signature:
class ValidatorFactory<V, O>
Generic Parameters
Parameter Description V Type of value to be validated
Javascript Import Format
define(['ojs/ojvalidationfactory-base'], function(validationfactoryBase) { // Application should call API on validationfactoryBase.ValidatorFactory })
Typescript Import Format
//To import this class, use the format below.
import {ValidatorFactory} from "ojs/ojvalidationfactory-base";
For additional information visit:
- See:
Constructor
(abstract) new ValidatorFactory
Customers can register custom validator factories for the supported types or create and register factories for new types altogether.
Fields
-
(static) VALIDATOR_TYPE_DATERESTRICTION :string
-
Default type for a factory used to create date restriction validators. This type is passed to the Validation.validatorFactory method to retrieve the dateRestriction validator factory of type oj.DateRestrictionValidatorFactory.
-
(static) VALIDATOR_TYPE_DATETIMERANGE :string
-
Default type for a factory used to create required validators. This type is passed to the Validation.validatorFactory method to retrieve the dateTimeRange validator factory of type oj.DateTimeRangeValidatorFactory.
-
(static) VALIDATOR_TYPE_LENGTH :string
-
Default type for a factory used to create length validators. This type is passed to the Validation.validatorFactory method to retrieve the length validator factory of type oj.LengthValidatorFactory.
-
(static) VALIDATOR_TYPE_NUMBERRANGE :string
-
Default type for a factory used to create numberRange validators. This type is passed to the Validation.validatorFactory method to retrieve the numberRange validator factory of type oj.NumberRangeValidatorFactory.
-
(static) VALIDATOR_TYPE_REGEXP :string
-
Default type for a factory used to create regExp validators. This type is passed to the Validation.validatorFactory method to retrieve the regExp validator factory of type oj.RegExpValidatorFactory.
-
(static) VALIDATOR_TYPE_REQUIRED :string
-
Default type for a factory used to create required validators. This type is passed to the Validation.validatorFactory method to retrieve the required validator factory of type oj.RequiredValidatorFactory.
Methods
-
createValidator(options) : {(oj.Validator.<V>|oj.AsyncValidator.<V>)}
-
Creates an immutable validator instance of the type the factory implements. For the specific options parameters, see the Validator jsdoc for the validator you are creating, e.g., oj.RequiredValidator if you are creating a required validator.
Parameters:
Name Type Description options
Object | null an object literal containing properties required by the validator for its initialization. The properties provided in the options is implementation specific. - See:
Throws:
if an unrecognized type was provided- Type
- TypeError
Returns:
a validator instance.
- Type
- (oj.Validator.<V>|oj.AsyncValidator.<V>)