Class: ConverterFactory

Oracle® JavaScript Extension Toolkit (JET)
8.1.0

F24337-01

Signature:

class ConverterFactory<V, O>

QuickNav

Fields


ConverterFactory

Version:
  • 8.1.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.ConverterFactory 
})
Typescript Import Format
//To import this class, use the format below.
import {ConverterFactory} from "ojs/ojvalidationfactory-base";
Generic Parameters
ParameterDescription
VType of value to be converted

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

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

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

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

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