|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mentawai.filter.PushVOFilter
public class PushVOFilter
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.
And it can also use prefix to separate attributes from multiple objects.
If enabled, it will try to automatically convert the fields beforing injecting
based on the field type, if it can find one.
Right now it only tries to convert booleans, ints, doubles and short dates, but you can extend this if you need to.
Constructor Summary | |
---|---|
PushVOFilter(Class<? extends Object> klass)
Creates a PushVOFilter that will try to create an object with the given class and populate this object with the action input values. |
|
PushVOFilter(Class klass,
boolean tryField)
Creates a PushVOFilter that will try to create an object with the given class and populate this object with the action input values. |
|
PushVOFilter(Class klass,
String key)
Creates a PushVOFilter that will try to create an object with the given class and populate this object with the action input values. |
|
PushVOFilter(Class klass,
String key,
boolean tryField)
Creates a PushVOFilter that will try to create an object with the given class and populate this object with the action input values. |
|
PushVOFilter(Class klass,
String key,
boolean tryField,
boolean convert,
String prefix)
Creates a PushVOFilter that will try to create an object with the given class and populate this object with the action input values. |
|
PushVOFilter(Class klass,
String key,
boolean tryField,
String prefix)
Creates a PushVOFilter that will try to create an object with the given class and populate this object with the action input values. |
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 |
getConvertedValue(String className,
String value,
Locale loc)
You can override this method to code more automatic conversions. |
protected boolean |
setValue(Object bean,
String name,
Object value,
Locale loc)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PushVOFilter(Class<? extends Object> klass)
klass
- The class to use to create the object.public PushVOFilter(Class klass, boolean tryField)
klass
- The class to use to create the object.tryField
- A flag indicating whether this filter should try to access private attributes.public PushVOFilter(Class klass, String key)
klass
- The class to use to create the object.key
- The key name used to place the object in the action input.public PushVOFilter(Class klass, String key, boolean tryField)
klass
- The class to use to create the object.key
- The key name used to place the object in the action input.tryField
- A flag indicating whether this filter should try to access private attributes.public PushVOFilter(Class klass, String key, boolean tryField, String prefix)
klass
- The class to use to create the object.key
- The key name used to place the object in the action input.tryField
- A flag indicating whether this filter should try to access private attributes.prefix
- The prefix that will come on every attribute. (Ex. user.name)public PushVOFilter(Class klass, String key, boolean tryField, boolean convert, String prefix)
klass
- The class to use to create the object.key
- The key name used to place the object in the action input.tryField
- A flag indicating whether this filter should try to access private attributes.convert
- A flag to indicate whether we should try to convert or not.prefix
- The prefix that will come on every attribute. (Ex. user.name)Method Detail |
---|
public String toString()
toString
in class Object
public String filter(InvocationChain chain) throws Exception
Filter
filter
in interface Filter
chain
- The InvocationChain for the action this filter is being applied to.
Exception
protected Object getConvertedValue(String className, String value, Locale loc)
className
- The type to convert tovalue
- The value to convertloc
- The locale to use for conversion (useful for date)
protected boolean setValue(Object bean, String name, Object value, Locale loc)
public void destroy()
Filter
destroy
in interface Filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |