SimpleNumber (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.template, class: SimpleNumber

Package freemarker.template

# Class SimpleNumber

java.lang.Object
freemarker.template.SimpleNumber

All Implemented Interfaces:
  `TemplateModel`, `TemplateNumberModel`, `Serializable`

public final class SimpleNumber extends Object implements TemplateNumberModel, Serializable
A simple implementation of the `TemplateNumberModel` interface. Note that this class is immutable.

This class is thread-safe.

See Also:
  Serialized Form

- ## Field Summary

  ### Fields inherited from interface freemarker.template.TemplateModel

  `NOTHING`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleNumber​(byte val)`
  `SimpleNumber​(double val)`
  `SimpleNumber​(float val)`
  `SimpleNumber​(int val)`
  `SimpleNumber​(long val)`
  `SimpleNumber​(short val)`
  `SimpleNumber​(Number value)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Number`
  `getAsNumber()`
  Returns the numeric value.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### SimpleNumber

    public SimpleNumber​(Number value)

  - ### SimpleNumber

    public SimpleNumber​(byte val)

  - ### SimpleNumber

    public SimpleNumber​(short val)

  - ### SimpleNumber

    public SimpleNumber​(int val)

  - ### SimpleNumber

    public SimpleNumber​(long val)

  - ### SimpleNumber

    public SimpleNumber​(float val)

  - ### SimpleNumber

    public SimpleNumber​(double val)

- ## Method Details

  - ### getAsNumber

    public Number getAsNumber()
    Description copied from interface: `TemplateNumberModel`
    Returns the numeric value. The return value must not be `null`.
    Specified by:
      `getAsNumber` in interface `TemplateNumberModel`
    Returns:
      the `Number` instance associated with this number model.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`