freemarker.core

## Class TemplateFormatUtil

- java.lang.Object
- - freemarker.core.TemplateFormatUtil

    public final class TemplateFormatUtil
    extends Object

Utility classes for implementing `TemplateValueFormat`-s.

Since:
  2.3.24

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `checkHasNoParameters(String params)`
`static Date` `getNonNullDate(TemplateDateModel dateModel)` Utility method to extract the `Date` from an `TemplateDateModel`, and throw `TemplateModelException` with a standard error message if that's `null`.
`static Number` `getNonNullNumber(TemplateNumberModel numberModel)` Utility method to extract the `Number` from an `TemplateNumberModel`, and throws `TemplateModelException` with a standard error message if that's `null`.

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

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

### Method Detail

#### checkHasNoParameters

    public static void checkHasNoParameters(String params)
                                     throws InvalidFormatParametersException

Throws:
  `InvalidFormatParametersException`

#### getNonNullNumber

    public static Number getNonNullNumber(TemplateNumberModel numberModel)
                                   throws TemplateModelException,
                                          UnformattableValueException

Utility method to extract the `Number` from an `TemplateNumberModel`, and throws `TemplateModelException` with a standard error message if that's `null`. `TemplateNumberModel` that store `null` are in principle not allowed, and so are considered to be bugs in the `ObjectWrapper` or `TemplateNumberModel` implementation.

Throws:
  `TemplateModelException`
  `UnformattableValueException`

#### getNonNullDate

    public static Date getNonNullDate(TemplateDateModel dateModel)
                               throws TemplateModelException

Utility method to extract the `Date` from an `TemplateDateModel`, and throw `TemplateModelException` with a standard error message if that's `null`. `TemplateDateModel` that store `null` are in principle not allowed, and so are considered to be bugs in the `ObjectWrapper` or `TemplateNumberModel` implementation.

Throws:
  `TemplateModelException`