org.mentawai.filter
Class OutjectionFilter

java.lang.Object
  extended by org.mentawai.core.OutputWrapper
      extended by org.mentawai.filter.OutjectionFilter
All Implemented Interfaces:
Map<String,Object>, AfterConsequenceFilter, Filter, Output

public class OutjectionFilter
extends OutputWrapper
implements AfterConsequenceFilter

A filter that takes all the properties of the action and place them in the output, so that you don't have to call output.setValue() manually. Note that for plain ations this filter uses the method action.getClass().getDeclaredMethods() in order to find the getters, in other words, it will only find getters of the base class and not from its superclasses. This is ok because action inheritance is not very common. If you are using a POJO action or a model-driven action it will use the method getMethods instead. For ModelDriven actions, the method action.getModel().getClass().getMethods() is used instead, pretty much like in the OVFilter.

Author:
Sergio Oliveira

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
OutjectionFilter()
          Creates a OutjectionFilter.
 
Method Summary
 void afterConsequence(Action action, Consequence c, boolean conseqExecuted, boolean actionExecuted, String result)
           
 void destroy()
          Gives a chance to the filter to deallocalte any resources before it is destroyed.
 String filter(InvocationChain chain)
          Executes the filter.
 Object getValue(String key)
          Gets an output value by name.
 
Methods inherited from class org.mentawai.core.OutputWrapper
add, clear, containsKey, containsValue, entrySet, get, has, isEmpty, keys, keySet, put, putAll, remove, removeOutput, removeValue, setObject, setObject, setOutput, setValue, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

OutjectionFilter

public OutjectionFilter()
Creates a OutjectionFilter.

Method Detail

getValue

public Object getValue(String key)
Description copied from interface: Output
Gets an output value by name.

Specified by:
getValue in interface Output
Overrides:
getValue in class OutputWrapper
Parameters:
key - The name of the value
Returns:
The value or null if it does not exist

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

afterConsequence

public void afterConsequence(Action action,
                             Consequence c,
                             boolean conseqExecuted,
                             boolean actionExecuted,
                             String result)
Specified by:
afterConsequence in interface AfterConsequenceFilter


Copyright © 2013. All Rights Reserved.