Module org.htmlunit

Class NumberFormat

java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.intl.NumberFormat
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class NumberFormat extends HtmlUnitScriptable
A JavaScript object for Intl.NumberFormat.
Author:
Ahmed Ashour, Ronald Brill, Lai Quang Duong
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Symbol.toStringTag support.

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, LEGACY_CONST, PERMANENT, READONLY, STRICTLY_READONLY, UNINITIALIZED_CONST

    Fields inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    isSealed

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    formatRange(Object start, Object end)
    Formats a range of numbers.
    org.htmlunit.corejs.javascript.Scriptable
    Formats a range of numbers into parts.
    org.htmlunit.corejs.javascript.Scriptable
    Formats a number into parts.
    Returns the JavaScript default value of this object.
    org.htmlunit.corejs.javascript.Function
    Returns the format function of this number format; the function is bound to this number format and formats a number according to the locale and the options.
    static org.htmlunit.corejs.javascript.Scriptable
    jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr)
    JavaScript constructor.
    org.htmlunit.corejs.javascript.Scriptable
    Returns the resolved options for this Intl.NumberFormat object.
    static org.htmlunit.corejs.javascript.Scriptable
    supportedLocalesOf(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
    Returns an array containing those of the provided locales that are supported without having to fall back to the default locale.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class org.htmlunit.corejs.javascript.SlotMapOwner

    associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMaps

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable

    get, getIds, has, has

    Methods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable

    get, has
  • Field Details

  • Constructor Details

    • NumberFormat

      public NumberFormat()
      Default constructor.
  • Method Details

    • jsConstructor

      public static org.htmlunit.corejs.javascript.Scriptable jsConstructor(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, Object[] args, org.htmlunit.corejs.javascript.Function ctorObj, boolean inNewExpr)
      JavaScript constructor.
      Parameters:
      cx - the current context
      scope - the scope
      args - the arguments to the NumberFormat constructor
      ctorObj - the function object
      inNewExpr - true if invoked with the new operator
      Returns:
      the Java object that JavaScript can access
      See Also:
    • getFormat

      public org.htmlunit.corejs.javascript.Function getFormat()
      Returns the format function of this number format; the function is bound to this number format and formats a number according to the locale and the options.
      Returns:
      the format function
    • formatToParts

      public org.htmlunit.corejs.javascript.Scriptable formatToParts(Object value)
      Formats a number into parts.
      Parameters:
      value - the number
      Returns:
      an array of objects with the type and the value of the parts
      See Also:
    • formatRange

      public String formatRange(Object start, Object end)
      Formats a range of numbers.
      Parameters:
      start - the start of the range
      end - the end of the range
      Returns:
      the formatted range
      See Also:
    • formatRangeToParts

      public org.htmlunit.corejs.javascript.Scriptable formatRangeToParts(Object start, Object end)
      Formats a range of numbers into parts.
      Parameters:
      start - the start of the range
      end - the end of the range
      Returns:
      an array of objects with the type, the value and the source of the parts
      See Also:
    • resolvedOptions

      public org.htmlunit.corejs.javascript.Scriptable resolvedOptions()
      Returns the resolved options for this Intl.NumberFormat object.
      Returns:
      a new object with properties reflecting the locale and number formatting options computed during the initialization of the given NumberFormat object.
    • supportedLocalesOf

      public static org.htmlunit.corejs.javascript.Scriptable supportedLocalesOf(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.VarScope scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args, org.htmlunit.corejs.javascript.Function funObj)
      Returns an array containing those of the provided locales that are supported without having to fall back to the default locale.
      Parameters:
      cx - the current context
      scope - the scope
      thisObj - the scriptable this
      args - the arguments; a string with a BCP 47 language tag or an array of such strings and the options (unused)
      funObj - the function object
      Returns:
      an array containing supported locales
    • getDefaultValue

      public Object getDefaultValue(Class<?> hint)
      Description copied from class: HtmlUnitScriptable
      Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java.
      Specified by:
      getDefaultValue in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      getDefaultValue in class HtmlUnitScriptable
      Parameters:
      hint - a hint as to the format of the default value (ignored in this case)
      Returns:
      the default value