Usage
Javascript Import Format
define(['ojs/ojvalidationfactory-base'], function(validationfactoryBase) { // Application should call API on validationfactoryBase.Validation })
Typescript Import Format
//To import this namespace, use the format below.
import {Validation} from "ojs/ojvalidationfactory-base";
For additional information visit:
Used to register and retrieve converterFactories and validationFactories.
There is no need to call the constructor.
Methods
-
(static) converterFactory<CF extends ConverterFactory<any, any>>(type:'number'|'color'|'datetime'|string, instance?:CF): CF|null
-
Method to register and retrieve converter factory instances by name. When passed only the name, an existing factory (registered for the name) is returned. Callers can expect to get back the default 'number', 'datetime', or 'color' converters. When passed two arguments, a new factory for the name is registered. If the name already exists the new instance replaces the old one.
Parameters:
Name Type Argument Description type
string a case insensitive name of the converter factory. e.g., 'number' (or oj.ConverterFactory.CONVERTER_TYPE_NUMBER), 'datetime' (or oj.ConverterFactory.CONVERTER_TYPE_DATETIME), or 'color' (or oj.ConverterFactory.CONVERTER_TYPE_COLOR). instance
Object <optional>
the instance of the factory that implements the contract for oj.ConverterFactory. - Deprecated:
-
Since Description 8.0.0
Directly create new instances ColorConverter, DateTimeConverter, and NumberConverter instead.
- See:
-
(static) Validation.getDefaultConverterFactory<V>(type: 'number'|'color'|'datetime'): ConverterFactory<V>|null
-
Returns the default converter factory instances for the supported types as defined by the oj.ConverterFactory. Instead of calling this method, it should be sufficient to use oj.Validation.converterFactory.
Parameters:
Name Type Description type
string The default converter factory for the type. Supported types are 'number' and 'datetime' Deprecated:
Since Description 8.0.0
Directly create new instances ColorConverter, DateTimeConverter, and NumberConverter instead. Returns:
an instance of oj.ConverterFactory or null if an unknown type is requested.
- Type
- Object | null
-
(static) Validation.getDefaultValidatorFactory<V>(type: 'required'|'regexp'|'numberRange'|'length'|'dateTimeRange'|'dateRestriction'): ValidatorFactory<V>|null
-
Returns the default validator factory instance for the requested types as defined by the oj.ValidatorFactory. Instead of calling this method, it should be sufficient to use oj.Validation.validatorFactory.
Parameters:
Name Type Description type
string The default converter factory for the type. Supported types are 'number' and 'datetime' Deprecated:
Since Description 8.0.0
Directly create new instances validator instead. Returns:
an instance of oj.ConverterFactory or null if an unknown type is requested.
- Type
- Object | null
-
(static) validatorFactory<VF extends ValidatorFactory<any,any>>(type:'required'|'regexp'|'numberRange'|'length'|'dateTimeRange'|'dateRestriction'|string, instance?:VF): VF|null
-
Method to register and retrieve validator factory instances by name. When passed only the name, an existing factory (registered for the name) is returned. When passed two arguments, a new factory for the name is registered. If the name already exists the new instance replaces the old one.
Parameters:
Name Type Argument Description type
string a case insensitive name of the validator factory. instance
Object <optional>
the instance of the factory that implements the contract for oj.ValidatorFactory. - Deprecated:
-
Since Description 8.0.0
Directly create new instances validator instead.
- Since:
- 8.0.0
- See:
Type Definitions
-
RegisteredConverter
-
A ducktype for accessing converter created and/ registered by referring to oj.Validation.converterFactory
Properties:
Name Type Argument Description options
Object <optional>
options to the converter type
string the name of the factory registered converter -
RegisteredValidator
-
A ducktype for accessing validator created and/ registered by referring to oj.Validation.validatorFactory
Properties:
Name Type Argument Description options
Object <optional>
options to the validator type
string the name of the factory registered validator