Class: ValidatorFactory

Oracle® JavaScript Extension Toolkit (JET)
17.0.0

F92240-01

Since:
  • 0.6.0
Module:
  • ojvalidationfactory-base

Note: This class is deprecated since 8.0.0. Use string literals instead of the member constants.

QuickNav

Fields

Description

Contract for a ValidatorFactory that provides a factory method to create a validator instance for the requested type. JET provides several factory implementations that implement this contract - for example dateRestriction, dateTimeRange, numberRange, length, required, regexp.

Customers can register custom validator factories for the supported types or create and register factories for new types altogether.


Usage

Signature:

class ValidatorFactory<V, O>

Generic Parameters
ParameterDescription
VType 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

Contract for a ValidatorFactory that provides a factory method to create a validator instance for the requested type. JET provides several factory implementations that implement this contract - for example dateRestriction, dateTimeRange, numberRange, length, required, regexp.

Customers can register custom validator factories for the supported types or create and register factories for new types altogether.

See:

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>)