Class: ConverterFactory

Oracle® JavaScript Extension Toolkit (JET)
15.1.0

F83698-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 ConverterFactory that provides a factory method to create a converter instance for the requested type. Factories handle the details of object creation. It allows the consumers of the factory to create specific converters without knowing the internals of the converter creation.

JET provides three factory implementations for number and datetime and color types that implement this contract.

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


Usage

Signature:

class ConverterFactory<V, O>

Generic Parameters
ParameterDescription
VType of value to be converted
Javascript Import Format
define(['ojs/ojvalidationfactory-base'], function(validationfactoryBase) {
 // Application should call API on validationfactoryBase.ConverterFactory 
})
Typescript Import Format
//To import this class, use the format below.
import {ConverterFactory} from "ojs/ojvalidationfactory-base";

For additional information visit:


See:

Constructor

(abstract) new ConverterFactory

Contract for a ConverterFactory that provides a factory method to create a converter instance for the requested type. Factories handle the details of object creation. It allows the consumers of the factory to create specific converters without knowing the internals of the converter creation.

JET provides three factory implementations for number and datetime and color types that implement this contract.

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

See:

Fields

(static) CONVERTER_TYPE_COLOR :string

Default type for a factory used to create color converters. This type is passed to the Validation.converterFactory method to retrieve the color converter factory of type oj.ColorConverterFactory.

(static) CONVERTER_TYPE_DATETIME :string

Default type for a factory used to create datetime converters. This type is passed to the Validation.converterFactory method to retrieve the datetime converter factory of type oj.DateTimeConverterFactory.

(static) CONVERTER_TYPE_NUMBER :string

Default type for a factory used to create number converters. This type is passed to the Validation.converterFactory method to retrieve the number converter factory of type oj.NumberConverterFactory.

Methods

createConverter(options?: O): Converter<V> | Promise.<Converter<V>>

Creates an immutable converter instance of the type the factory implements.
Parameters:
Name Type Argument Description
options Object <optional>
an object literal containing properties required by the converter for its initialization. The properties provided in the options is implementation specific.
Throws:
if an unrecognized type was provided
Type
TypeError
Returns:

a converter instance.

Type
oj.Converter