com.endeca.portal.format
Class Formatter

java.lang.Object
  extended by com.endeca.portal.format.Formatter
All Implemented Interfaces:
FormatSettings, java.io.Serializable
Direct Known Subclasses:
BooleanFormatter, DateTimeFormatter, DurationFormatter, GeocodeFormatter, NumberFormatter, StringFormatter, TimeFormatter

public abstract class Formatter
extends java.lang.Object
implements FormatSettings, java.io.Serializable

Base formatter class that provides read/write interface (getter/setter) for visiting the format settings and the abstract format function.

See Also:
Serialized Form

Nested Class Summary
static class Formatter.FormatParseException
           
 
Nested classes/interfaces inherited from interface com.endeca.portal.format.FormatSettings
FormatSettings.Type
 
Field Summary
protected  FormatSettings parentFormatSettings
           
protected  FormatSettings.Type type
           
 
Constructor Summary
Formatter()
           
 
Method Summary
abstract  java.lang.String format(java.lang.String rawString)
           
 java.util.Locale getLocale()
           
 FormatSettings getParentFormatSettings()
           
 FormatSettings.Type getType()
           
protected  void loadResources(javax.portlet.PortletRequest request)
          Subclasses need to override this method to load resources when needed.
protected  void localeChanged()
          Subclasses can override this method to clear/reset some cached data that is dependent on locale, for example cached Java format.
protected  void parentFormatSettingsChanged()
          Subclasses can override this method to clear/reset some cached data that is dependent on parent format settings, for example cached Java format.
 void setLocale(java.util.Locale locale)
          Retrieve locale for specified locale.
 void setLocale(javax.portlet.PortletRequest request)
          Retrieve locale and resources from PortletRequest.
 void setParentFormatSettings(FormatSettings parentFormatSettings)
          Subclasses need to override this method and validate parentFormatSettings.
 void setType(FormatSettings.Type type)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected FormatSettings.Type type

parentFormatSettings

protected FormatSettings parentFormatSettings
Constructor Detail

Formatter

public Formatter()
Method Detail

getLocale

public java.util.Locale getLocale()

setLocale

public void setLocale(javax.portlet.PortletRequest request)
Retrieve locale and resources from PortletRequest.

Parameters:
request -

setLocale

public void setLocale(java.util.Locale locale)
Retrieve locale for specified locale.

Parameters:
locale -

loadResources

protected void loadResources(javax.portlet.PortletRequest request)
Subclasses need to override this method to load resources when needed.

Parameters:
request -

getType

public FormatSettings.Type getType()
Specified by:
getType in interface FormatSettings

setType

public void setType(FormatSettings.Type type)

getParentFormatSettings

public FormatSettings getParentFormatSettings()

setParentFormatSettings

public void setParentFormatSettings(FormatSettings parentFormatSettings)
Subclasses need to override this method and validate parentFormatSettings.

Parameters:
parentFormatSettings -

localeChanged

protected void localeChanged()
Subclasses can override this method to clear/reset some cached data that is dependent on locale, for example cached Java format.


parentFormatSettingsChanged

protected void parentFormatSettingsChanged()
Subclasses can override this method to clear/reset some cached data that is dependent on parent format settings, for example cached Java format.


format

public abstract java.lang.String format(java.lang.String rawString)
                                 throws Formatter.FormatParseException
Throws:
Formatter.FormatParseException

toString

public java.lang.String toString()
Specified by:
toString in interface FormatSettings
Overrides:
toString in class java.lang.Object