org.apache.velocity.tools.generic

## Class FormatConfig

- java.lang.Object
- - org.apache.velocity.tools.generic.SafeConfig
  - - org.apache.velocity.tools.generic.LocaleConfig
    - - org.apache.velocity.tools.generic.FormatConfig

Direct Known Subclasses:
  DateTool, MathTool, NumberTool, ValueParser

    public class FormatConfig
    extends LocaleConfig

Implements common logic and constants for tools which allow their default format to be configured.

Since:
  VelocityTools 2.0
Author:
  Nathan Bubna

### Field Summary

Fields
`static String` `DEFAULT_FORMAT` The default format to be used when none is specified.
`static String` `FORMAT_KEY` The key used for specifying a default format via tool configuration.

### Fields inherited from class org.apache.velocity.tools.generic.LocaleConfig

`DEFAULT_LOCALE`

### Fields inherited from class org.apache.velocity.tools.generic.SafeConfig

`LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY`

### Constructor Summary

Constructors
Constructor and Description
`FormatConfig()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected void` `configure(ValueParser values)` Does the actual configuration.
`String` `getFormat()` This returns the configured default format for this tool.
`protected void` `setFormat(String format)` Sets the default format for this instance.

### Methods inherited from class org.apache.velocity.tools.generic.LocaleConfig

`getLocale, setLocale, toLocale`

### Methods inherited from class org.apache.velocity.tools.generic.SafeConfig

`configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode`

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

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

### Field Detail

#### DEFAULT_FORMAT

    public static final String DEFAULT_FORMAT

The default format to be used when none is specified.

See Also:
  Constant Field Values

#### FORMAT_KEY

    public static final String FORMAT_KEY

The key used for specifying a default format via tool configuration.

See Also:
  Constant Field Values

### Constructor Detail

#### FormatConfig

    public FormatConfig()

### Method Detail

#### configure

    protected void configure(ValueParser values)

Does the actual configuration. This is protected, so subclasses may share the same ValueParser and call configure at any time, while preventing templates from doing so when configure(Map) is locked.

Overrides:
  `configure` in class `LocaleConfig`
Parameters:
  `values` - configuration values

#### getFormat

    public String getFormat()

This returns the configured default format for this tool.

Returns:
  the default `String`

#### setFormat

    protected void setFormat(String format)

Sets the default format for this instance.

Parameters:
  `format` - default format