Class: NumberConverter

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

class NumberConverter implements Converter<number>

QuickNav


NumberConverter

Version:
  • 7.1.0
Since:
  • 0.6
Module:
  • ojvalidation-number

Module usage

See JET Module Loading for an overview of module usage within JET.

Javascript Import Format
define(['ojs/ojvalidation-number'], function(validationNumber) {
 // Application should call API on validationNumber.NumberConverter 
})
Typescript Import Format
//To import this class, use the format below.
import {NumberConverter} from "ojs/ojvalidation-number";

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 NumberConverter()

In most use cases you will use the ConverterFactory to get an instance of a NumberConverter or you will use new oj.IntlNumberConverter.
See:

Methods

format(value) → {string|null}

Formats the Number value using the options provided and returs a String value.
Parameters:
Name Type Description
value number the value to be formatted for display
Throws:
a ConverterError if formatting fails.
Type
Error
Returns:
the localized and formatted value suitable for display
Type
string | null

getHint(): string|null

Returns a hint that describes the converter format expected.
Inherited From:
Returns:
a hint describing the format the value is expected to be in.
Type
string | null

getOptions(): object

Returns the options called with converter initialization.
Inherited From:
Returns:
an object of options.
Type
Object

parse(value) → {number|null}

Parses the value using the options provided and returns a Number object.
Parameters:
Name Type Description
value string to parse
Throws:
a ConverterError if parsing fails
Type
Error
Returns:
the parsed value as a Number object.
Type
number | null

resolvedOptions(): object

Returns an object literal with locale and formatting options computed during initialization of the object. If options was not provided at the time of initialization, the properties will be derived from the locale defaults.
Inherited From:
Returns:
an object of resolved options.
Type
Object