Class: ConverterFactory

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

class ConverterFactory<V>

QuickNav

Fields


ConverterFactory

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 {ConverterFactory} from "ojs/ojvalidation-base";

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

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) → {oj.Converter.<V>}

Creates an immutable converter instance of the type the factory implements.
Parameters:
Name Type Description
options Object | null 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.<V>