com.endeca.portal.format
Class DurationFormatter
java.lang.Object
com.endeca.portal.format.Formatter
com.endeca.portal.format.DurationFormatter
- All Implemented Interfaces:
- DurationFormatSettings, FormatSettings, java.io.Serializable
public class DurationFormatter
- extends Formatter
- implements DurationFormatSettings
Formatter for formatting Duration type based on locale and format settings.
If the value of a format setting is DEFAULT, the value of the format setting of its parent will be used if it is not DEFAULT.
Otherwise, system default value of that format setting will be used.
The precision unit strings "days", "hours", "minutes", "seconds" and "milliseconds" are locale sensitive. The resources for them are stored in resource bundle.
It is caller's responsibility to call setLocalizedPrecisionUnitStrings() to pass in the localized resources.
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DEFAULT_PRECISION
public static final DurationFormatSettings.Precision DEFAULT_PRECISION
DEFAULT_INCLUDE_PRECISION_UNIT
public static final DurationFormatSettings.IncludePrecisionUnit DEFAULT_INCLUDE_PRECISION_UNIT
DEFAULT_DECIMAL_PLACES_MODE
public static final DurationFormatSettings.DecimalPlacesMode DEFAULT_DECIMAL_PLACES_MODE
DEFAULT_DECIMAL_PLACES
public static final int DEFAULT_DECIMAL_PLACES
- See Also:
- Constant Field Values
DurationFormatter
public DurationFormatter()
loadResources
protected void loadResources(javax.portlet.PortletRequest request)
- Description copied from class:
Formatter
- Subclasses need to override this method to load resources when needed.
- Overrides:
loadResources in class Formatter
getPrecision
public DurationFormatSettings.Precision getPrecision()
- Specified by:
getPrecision in interface DurationFormatSettings
setPrecision
public void setPrecision(DurationFormatSettings.Precision precision)
getMergedPrecision
public DurationFormatSettings.Precision getMergedPrecision()
- Specified by:
getMergedPrecision in interface DurationFormatSettings
getIncludePrecisionUnit
public DurationFormatSettings.IncludePrecisionUnit getIncludePrecisionUnit()
- Specified by:
getIncludePrecisionUnit in interface DurationFormatSettings
setIncludePrecisionUnit
public void setIncludePrecisionUnit(DurationFormatSettings.IncludePrecisionUnit includePrecisionUnit)
getMergedIncludePrecisionUnit
public DurationFormatSettings.IncludePrecisionUnit getMergedIncludePrecisionUnit()
- Specified by:
getMergedIncludePrecisionUnit in interface DurationFormatSettings
getDecimalPlacesMode
public DurationFormatSettings.DecimalPlacesMode getDecimalPlacesMode()
- Specified by:
getDecimalPlacesMode in interface DurationFormatSettings
setDecimalPlacesMode
public void setDecimalPlacesMode(DurationFormatSettings.DecimalPlacesMode decimalPlacesMode)
getMergedDecimalPlacesMode
public DurationFormatSettings.DecimalPlacesMode getMergedDecimalPlacesMode()
- Specified by:
getMergedDecimalPlacesMode in interface DurationFormatSettings
getDecimalPlaces
public int getDecimalPlaces()
- Specified by:
getDecimalPlaces in interface DurationFormatSettings
setDecimalPlaces
public void setDecimalPlaces(int decimalPlaces)
getMergedDecimalPlaces
public int getMergedDecimalPlaces()
- Specified by:
getMergedDecimalPlaces in interface DurationFormatSettings
localeChanged
protected void localeChanged()
- Description copied from class:
Formatter
- Subclasses can override this method to clear/reset some cached data that is dependent on locale, for example cached Java format.
- Overrides:
localeChanged in class Formatter
parentFormatSettingsChanged
protected void parentFormatSettingsChanged()
- Description copied from class:
Formatter
- Subclasses can override this method to clear/reset some cached data that is dependent on parent format settings,
for example cached Java format.
- Overrides:
parentFormatSettingsChanged in class Formatter
clearCachedJavaFormat
protected void clearCachedJavaFormat()
createJavaFormat
protected void createJavaFormat()
initializeJavaFormat
protected void initializeJavaFormat()
getCachedJavaFormat
protected java.text.NumberFormat getCachedJavaFormat()
parseSeconds
public static double parseSeconds(java.lang.String mdexValue)
throws Formatter.FormatParseException
- Throws:
Formatter.FormatParseException
format
public java.lang.String format(java.lang.String str)
throws Formatter.FormatParseException
- Specified by:
format in class Formatter
- Throws:
Formatter.FormatParseException