com.opensymphony.xwork.util
Class InstantiatingNullHandler
java.lang.Object
com.opensymphony.xwork.util.InstantiatingNullHandler
- All Implemented Interfaces:
- ognl.NullHandler
- public class InstantiatingNullHandler
- extends Object
- implements ognl.NullHandler
Normally does nothing, but if CREATE_NULL_OBJECTS
is in the action context
with a value of true, then this class will attempt to create null objects when Ognl
requests null objects be created.
The following rules are used:
- If the null property is a simple bean with a no-arg constructor, it will simply be
created using ObjectFactory's
buildBean
method.
- If the property is declared exactly as a
Collection
or List
, then this class
will look in the conversion property file (see XWorkConverter
) for an entry
with a key of the form "Collection_[propertyName]". Using the value of this key as
the class type in which the collection will be holding, an XWorkList
will be
created, allowing simple dynamic insertion.
- If the property is declared as a
Map
, then the same rules are applied for
list, except that an XWorkMap
will be created instead.
- Author:
- Matt Ho, Patrick Lightbody
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CREATE_NULL_OBJECTS
public static final String CREATE_NULL_OBJECTS
- See Also:
- Constant Field Values
InstantiatingNullHandler
public InstantiatingNullHandler()
nullMethodResult
public Object nullMethodResult(Map context,
Object target,
String methodName,
Object[] args)
- Specified by:
nullMethodResult
in interface ognl.NullHandler
nullPropertyValue
public Object nullPropertyValue(Map context,
Object target,
Object property)
- Specified by:
nullPropertyValue
in interface ognl.NullHandler
getCollectionType
protected Class getCollectionType(Class clazz,
String property)