Package org.apache.poi.ss.format
Class CellFormatter
- java.lang.Object
-
- org.apache.poi.ss.format.CellFormatter
-
- Direct Known Subclasses:
CellDateFormatter
,CellElapsedFormatter
,CellGeneralFormatter
,CellNumberFormatter
,CellTextFormatter
public abstract class CellFormatter extends Object
This is the abstract supertype for the various cell formatters.
-
-
Constructor Summary
Constructors Constructor Description CellFormatter(String format)
Creates a new formatter object, storing the format informat
.CellFormatter(Locale locale, String format)
Creates a new formatter object, storing the format informat
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
format(Object value)
Formats the value, returning the resulting string.abstract void
formatValue(StringBuffer toAppendTo, Object value)
Format a value according the format string.protected void
setSectionFourTextFormat(boolean sectionFour)
String
simpleFormat(Object value)
Formats the value in the most basic way, returning the resulting string.abstract void
simpleValue(StringBuffer toAppendTo, Object value)
Format a value according to the type, in the most basic way.
-
-
-
Method Detail
-
formatValue
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
- The buffer to append to.value
- The value to format.
-
simpleValue
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
- The buffer to append to.value
- The value to format.
-
format
public String format(Object value)
Formats the value, returning the resulting string.- Parameters:
value
- The value to format.- Returns:
- The value, formatted.
-
simpleFormat
public String simpleFormat(Object value)
Formats the value in the most basic way, returning the resulting string.- Parameters:
value
- The value to format.- Returns:
- The value, formatted.
-
setSectionFourTextFormat
protected void setSectionFourTextFormat(boolean sectionFour)
-
-