java.lang.Object
org.mentawai.filter.InjectionFilter
- All Implemented Interfaces:
- org.mentawai.core.Filter
- public class InjectionFilter
- extends java.lang.Object
- implements org.mentawai.core.Filter
A filter that tries to inject the input values in the action through setters. (Ex. setUsername(), setPassword(), etc.)
It can also inject the input value directly in the attribute, even if it is a private field.
Use this filter if you don't want to deal with the action input object and instaed you want to inject its values in the action.
This filter tries to inject all the input values in the action.
|
Constructor Summary |
InjectionFilter()
Creates an InjectionFilter that can be used by any action class. |
InjectionFilter(boolean tryField)
Creates an InjectionFilter that can be used by any action class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
methods
private java.util.Map methods
tryField
private boolean tryField
InjectionFilter
public InjectionFilter()
- Creates an 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.
getField
static java.lang.reflect.Field getField(java.lang.Object target,
java.lang.String name)
setValue
private void setValue(java.lang.Object target,
java.lang.String name,
java.lang.Object value)
getPrimitiveFrom
static java.lang.Class getPrimitiveFrom(java.lang.Object w)
filter
public java.lang.String filter(org.mentawai.core.InvocationChain chain)
throws java.lang.Exception
- Description copied from interface:
org.mentawai.core.Filter
- Executes the filter.
- Specified by:
filter in interface org.mentawai.core.Filter
destroy
public void destroy()
- Description copied from interface:
org.mentawai.core.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 org.mentawai.core.Filter