Top Description Fields Constructors Methods
org.apache.poi.ss.format

public abstract Class CellFormatter

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.poi.ss.format.CellGeneralFormatter, org.apache.poi.ss.format.CellNumberFormatter, org.apache.poi.ss.format.CellNumberFormatter.GeneralNumberFormatter, org.apache.poi.ss.format.CellTextFormatter, org.apache.poi.ss.format.CellDateFormatter, org.apache.poi.ss.format.CellElapsedFormatter
Imports
java.util.Locale, org.apache.poi.util.LocaleUtil

This is the abstract supertype for the various cell formatters.

Field Summary

Modifier and TypeField and Description
protected final String
format

The original specified format.

protected final Locale

Constructor Summary

AccessConstructor and Description
public
CellFormatter(String
The format.
format
)

Creates a new formatter object, storing the format in format.

public
CellFormatter(Locale
The locale.
locale
,
String
The format.
format
)

Creates a new formatter object, storing the format in format.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The value, formatted.
format
(Object
The value to format.
value
)

Formats the value, returning the resulting string.

public abstract void
formatValue(StringBuffer
The buffer to append to.
toAppendTo
,
Object
The value to format.
value
)

Format a value according the format string.

pack-priv static String

Returns:

The input string, surrounded by quotes.
quote
(String
The string to quote.
str
)

Returns the input string, surrounded by quotes.

public String

Returns:

The value, formatted.
simpleFormat
(Object
The value to format.
value
)

Formats the value in the most basic way, returning the resulting string.

public abstract void
simpleValue(StringBuffer
The buffer to append to.
toAppendTo
,
Object
The value to format.
value
)

Format a value according to the type, in the most basic way.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

formatback to summary
protected final String format

The original specified format.

localeback to summary
protected final Locale locale

Constructor Detail

CellFormatterback to summary
public CellFormatter(String format)

Creates a new formatter object, storing the format in format.

Parameters
format:String

The format.

CellFormatterback to summary
public CellFormatter(Locale locale, String format)

Creates a new formatter object, storing the format in format.

Parameters
locale:Locale

The locale.

format:String

The format.

Method Detail

formatback to summary
public String format(Object value)

Formats the value, returning the resulting string.

Parameters
value:Object

The value to format.

Returns:String

The value, formatted.

formatValueback to summary
public abstract void formatValue(StringBuffer toAppendTo, Object value)

Format a value according the format string.

Note

this method must be thread safe! In particular, if it uses a Format instance that is not thread safe, i.e. DateFormat, this method must be synchronized, either on the method, if the format is a final property, or on the format instance itself.

Parameters
toAppendTo:StringBuffer

The buffer to append to.

value:Object

The value to format.

quoteback to summary
pack-priv static String quote(String str)

Returns the input string, surrounded by quotes.

Parameters
str:String

The string to quote.

Returns:String

The input string, surrounded by quotes.

simpleFormatback to summary
public String simpleFormat(Object value)

Formats the value in the most basic way, returning the resulting string.

Parameters
value:Object

The value to format.

Returns:String

The value, formatted.

simpleValueback to summary
public abstract void simpleValue(StringBuffer toAppendTo, Object value)

Format a value according to the type, in the most basic way.

Note

this method must be thread safe! In particular, if it uses a Format instance that is not thread safe, i.e. DateFormat, this method must be synchronized, either on the method, if the format is a final property, or on the format instance itself.

Parameters
toAppendTo:StringBuffer

The buffer to append to.

value:Object

The value to format.