Class: ConverterFactory

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

Fields

oj. ConverterFactory

Version:
  • 3.2.0

Constructor

<abstract> new ConverterFactory()

Contract for a ConverterFactory that provides a factory method to create a converter instance for the requested type. JET provides two factory implementations for number and datetime types that implement this contract. Customers can register custom converter factories for the supported types or create and register factories for new types altogether.
Source:
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.
Source:

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

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

Methods

<static> createConverter(options) → {Object}

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.
Source:
Throws:
if an unrecognized type was provided
Type
TypeError
Returns:
a converter instance.
Type
Object
Example

Create a JET dateTime converter with options

var dateTimeCvtr = oj.Validation.converterFactory(oj.ConverterFactory.CONVERTER_TYPE_DATETIME);
var dateOptions = {day: 'numeric', month: 'numeric'};
var dayMonthConverter = dateTimeCvtr.createConverter(dateOptions);