org.mentawai.filter
Class OVFilter

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

public class OVFilter
extends Object
implements Filter

A filter that takes all the properties of a bean and place them in the action output. Use this filter, for example, if you want to show all properties of an User bean, but you don't want to manually place them in the action output, in other words, you place the User bean in the output and use the OVFilter to accomplish the same result.
Note that this filter uses the method Class.getMethods() in order to find the getters, in other words, getters from the class and its superclasses will be called for properties.

Author:
Sergio Oliveira

Field Summary
static char PREFIX_SEPARATOR
           
 
Constructor Summary
OVFilter(String key)
          Creates a OVFilter that will be applied to the bean in the action output with the given key.
OVFilter(String key, boolean overwrite)
          Creates a OVFilter that will be applied to the bean in the action output with the given key.
OVFilter(String key, String prefix)
          Creates a OVFilter that will be applied to the bean in the action output with the given key.
OVFilter(String key, String prefix, boolean overwrite)
          Creates a OVFilter that will be applied to the bean in the action output with the given key.
 
Method Summary
 void destroy()
          Gives a chance to the filter to deallocalte any resources before it is destroyed.
 String filter(InvocationChain chain)
          Executes the filter.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PREFIX_SEPARATOR

public static char PREFIX_SEPARATOR
Constructor Detail

OVFilter

public OVFilter(String key)
Creates a OVFilter that will be applied to the bean in the action output with the given key.

Parameters:
key - The key with which the object (bean) is placed in the action output.

OVFilter

public OVFilter(String key,
                String prefix)
Creates a OVFilter that will be applied to the bean in the action output with the given key.

Parameters:
key - The key with which the object (bean) is placed in the action output.
prefix - The prefix will be appended to the attribute name on the action output.

OVFilter

public OVFilter(String key,
                boolean overwrite)
Creates a OVFilter that will be applied to the bean in the action output with the given key.

Parameters:
key - The key with which the object (bean) is placed in the action output.
overwrite - Overwrite the value in the output if it is already there? (default is true)

OVFilter

public OVFilter(String key,
                String prefix,
                boolean overwrite)
Creates a OVFilter that will be applied to the bean in the action output with the given key.

Parameters:
key - The key with which the object (bean) is placed in the action output.
prefix - The prefix will be appended to the attribute name on the action output.
overwrite - Overwrite the value in the output if it is already there? (default is true)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

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.