public class InstantiatingNullHandler extends Object implements NullHandler
ReflectionContextState.CREATE_NULL_OBJECTS
is in the action context with a value of true (this key is set
only during the execution of the ParametersInterceptor
), OGNL expressions
that have caused a NullPointerException will be temporarily stopped for evaluation while the system automatically
tries to solve the null references by automatically creating the object.
The following rules are used when handling null references:
Collection
or List
, then an ArrayList shall be
returned and assigned to the null references.Map
, then a HashMap will be returned and assigned to the null
references.ObjectFactory.buildBean(java.lang.Class, java.util.Map)
method.Modifier and Type | Field and Description |
---|---|
static String |
CREATE_NULL_OBJECTS
Deprecated.
Use
ReflectionContextState.CREATE_NULL_OBJECTS instead |
Constructor and Description |
---|
InstantiatingNullHandler() |
Modifier and Type | Method and Description |
---|---|
Object |
nullMethodResult(Map<String,Object> context,
Object target,
String methodName,
Object[] args)
Method called on target returned null.
|
Object |
nullPropertyValue(Map<String,Object> context,
Object target,
Object property)
Property in target evaluated to null.
|
void |
setObjectFactory(ObjectFactory fac) |
void |
setObjectTypeDeterminer(ObjectTypeDeterminer det) |
void |
setReflectionProvider(ReflectionProvider prov) |
@Deprecated public static final String CREATE_NULL_OBJECTS
ReflectionContextState.CREATE_NULL_OBJECTS
insteadpublic void setObjectTypeDeterminer(ObjectTypeDeterminer det)
public void setReflectionProvider(ReflectionProvider prov)
public void setObjectFactory(ObjectFactory fac)
public Object nullMethodResult(Map<String,Object> context, Object target, String methodName, Object[] args)
NullHandler
nullMethodResult
in interface NullHandler
public Object nullPropertyValue(Map<String,Object> context, Object target, Object property)
NullHandler
nullPropertyValue
in interface NullHandler
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.