org.mentawai.filter
Class FormatFilter

java.lang.Object
  extended by org.mentawai.filter.FormatFilter
All Implemented Interfaces:
Filter

public abstract class FormatFilter
extends Object
implements Filter

A filter to format the action output values. Use this filter if you want to format some of your output values before displaying them in the view.

Author:
Sergio Oliveira

Constructor Summary
FormatFilter()
           
 
Method Summary
 FormatFilter add(String field, Formatter formatter)
          Adds a formatter for the given field.
 FormatFilter add(String field, String formatterName)
          Adds a formatter which was defined in the FormatterManager.
 void destroy()
          Gives a chance to the filter to deallocalte any resources before it is destroyed.
 String filter(InvocationChain chain)
          Executes the filter.
abstract  void initFormatters()
          Override this abstract method to add formatters for the output fields you want to format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormatFilter

public FormatFilter()
Method Detail

initFormatters

public abstract void initFormatters()
Override this abstract method to add formatters for the output fields you want to format.


add

public FormatFilter add(String field,
                        Formatter formatter)
Adds a formatter for the given field.

Parameters:
field - The field to format.
formatter - The formatter to use.
Returns:
This FormatFilter object (this) so you can chain methods

add

public FormatFilter add(String field,
                        String formatterName)
Adds a formatter which was defined in the FormatterManager.

Parameters:
field -
formatterName - The name of the formatter defined in the FormatterManager.
Returns:
This FormatFilter object (this) so you can chain methods

filter

public String filter(InvocationChain chain)
              throws Exception
Description copied from interface: Filter
Executes the filter.

Specified by:
filter in interface Filter
Parameters:
chain - The InvocationChain for the action this filter is being applied to.
Returns:
The result of the filter or the action the filter is being applied to.
Throws:
Exception

destroy

public void destroy()
Description copied from interface: Filter
Gives a chance to the filter to deallocalte any resources before it is destroyed. This is called when the web application is stopped, in other words, this has nothing to do with garbage collection.

Specified by:
destroy in interface Filter


Copyright © 2013. All Rights Reserved.