Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mentawai.filter
Class VOFilter  view VOFilter download VOFilter.java

java.lang.Object
  extended byorg.mentawai.filter.VOFilter
All Implemented Interfaces:
org.mentawai.core.Filter

public class VOFilter
extends java.lang.Object
implements org.mentawai.core.Filter

A filter that tries to populate a bean with the action input values. Use this filter if you want to provide your action with a ready-to-use bean instead of a bunch of action input values. This filter tries to inject all the action input values in a Java object through setters. It can also inject directly in the bean's attributes, even if the field is private.


Field Summary
private  java.util.Map cache
           
private  java.lang.String key
           
private  java.lang.Class klass
           
private  boolean tryField
           
 
Constructor Summary
VOFilter(java.lang.Class klass)
          Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values.
VOFilter(java.lang.Class klass, boolean tryField)
          Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values.
VOFilter(java.lang.Class klass, java.lang.String key)
          Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values.
VOFilter(java.lang.Class klass, java.lang.String key, boolean tryField)
          Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values.
 
Method Summary
private  java.lang.Object createObject()
           
 void destroy()
          Gives a chance to the filter to deallocalte any resources before it is destroyed.
 java.lang.String filter(org.mentawai.core.InvocationChain chain)
          Executes the filter.
private  void setValue(java.lang.Object bean, java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

klass

private java.lang.Class klass

key

private java.lang.String key

cache

private java.util.Map cache

tryField

private boolean tryField
Constructor Detail

VOFilter

public VOFilter(java.lang.Class klass)
Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values.


VOFilter

public VOFilter(java.lang.Class klass,
                boolean tryField)
Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values. 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.


VOFilter

public VOFilter(java.lang.Class klass,
                java.lang.String key)
Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values. The object will be placed in the action input with the given key.


VOFilter

public VOFilter(java.lang.Class klass,
                java.lang.String key,
                boolean tryField)
Creates a VOFilter that will try to create an object with the given class and populate this object with the action input values. The object will be placed in the action input with the given key. 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.

Method Detail

createObject

private java.lang.Object createObject()

setValue

private void setValue(java.lang.Object bean,
                      java.lang.String name,
                      java.lang.Object value)

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