org.mentawai.filter
Class InjectionFilter

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

public class InjectionFilter
extends Object
implements Filter

This filter will inject input values into the action or model.

Author:
Sergio Oliveira

Constructor Summary
InjectionFilter()
          Creates a InjectionFilter that can be used by any action class.
InjectionFilter(boolean tryField)
          Creates an InjectionFilter that can be used by any action class.
InjectionFilter(boolean tryField, boolean convert)
          Creates an InjectionFilter that can be used by any action class.
InjectionFilter(boolean tryField, boolean convert, boolean convertNullToFalse)
          Force NULL values to be converted to FALSE booleans (only when type is Boolean or boolean!)
 
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.
protected  Object getTarget(Action action)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InjectionFilter

public InjectionFilter()
Creates a InjectionFilter that can be used by any action class. You may use this filter per action or as a global filter.


InjectionFilter

public InjectionFilter(boolean tryField)
Creates an InjectionFilter that can be used by any action class. You may use this filter per action or as a global filter. If tryField is true and it cannot find a setter for the input value, it will try to directly access the attribute, even if it is a private field.

Parameters:
tryField - A flag indicating whether this filter should try to access private attributes.

InjectionFilter

public InjectionFilter(boolean tryField,
                       boolean convert)
Creates an InjectionFilter that can be used by any action class. You may use this filter per action or as a global filter. If tryField is true and it cannot find a setter for the input value, it will try to directly access the attribute, even if it is a private field. If convert flag is true (default), it will try to automatically convert.

Parameters:
tryField - A flag indicating whether this filter should try to access private attributes.

InjectionFilter

public InjectionFilter(boolean tryField,
                       boolean convert,
                       boolean convertNullToFalse)
Force NULL values to be converted to FALSE booleans (only when type is Boolean or boolean!)

Parameters:
tryField -
convert -
convertNullToFalse -
Since:
1.11
Method Detail

getTarget

protected Object getTarget(Action action)
                    throws FilterException
Throws:
FilterException

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.