Class: ValidatorFactory

Oracle® JavaScript Extension Toolkit (JET)
9.0.0

F24343-01

Signature:

class ValidatorFactory<V, O>

QuickNav

Fields

ValidatorFactory

Version:
  • 9.0.0
Since:
  • 0.6.0
Module:
  • ojvalidationfactory-base

Module usage

See JET Module Loading for an overview of module usage within JET.

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";
Generic Parameters
ParameterDescription
VType of value to be validated

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.

Deprecated:
Since Description
8.0.0 Use string literals instead of the member constants.
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.

Deprecated:
Since Description
8.0.0 Use string literals instead of the member constants.
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.
Deprecated:
Since Description
8.0.0 Use the string instead.

(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.
Deprecated:
Since Description
8.0.0 Use the string instead.

(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.
Deprecated:
Since Description
8.0.0 Use the string instead.

(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.
Deprecated:
Since Description
8.0.0 Use the string instead.

(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.
Deprecated:
Since Description
8.0.0 Use the string instead.

(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.
Deprecated:
Since Description
8.0.0 Use the string instead.

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