Class: ValidatorFactory

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

class ValidatorFactory<V>

QuickNav

Fields


ValidatorFactory

Version:
  • 7.1.0
Since:
  • 0.6
Module:
  • ojvalidation-base

Module usage

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

Typescript Import Format
//This class is not exported from module and can not be accessed in runtime.
//However to enable typechecking and ducktyping, you can access it as an interface.
import {ValidatorFactory} from "ojs/ojvalidation-base";

//To access this type in your code,
class MyClass implements ValidatorFactory{
//or,
let myVariable: ValidatorFactory;
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.

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

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>