public class OgnlUtil extends Object
Constructor and Description |
---|
OgnlUtil() |
Modifier and Type | Method and Description |
---|---|
Object |
compile(String expression) |
Object |
compile(String expression,
Map<String,Object> context) |
void |
copy(Object from,
Object to,
Map<String,Object> context)
Copies the properties in the object "from" and sets them in the object "to"
using specified type converter, or
XWorkConverter if none
is specified. |
void |
copy(Object from,
Object to,
Map<String,Object> context,
Collection<String> exclusions,
Collection<String> inclusions)
Copies the properties in the object "from" and sets them in the object "to"
using specified type converter, or
XWorkConverter if none
is specified. |
protected Map |
createDefaultContext(Object root) |
protected Map |
createDefaultContext(Object root,
ognl.ClassResolver classResolver) |
BeanInfo |
getBeanInfo(Class clazz)
Get's the java bean info for the given source.
|
BeanInfo |
getBeanInfo(Object from)
Get's the java bean info for the given source object.
|
Map<String,Object> |
getBeanMap(Object source)
Creates a Map with read properties for the given source object.
|
Set<Class<?>> |
getExcludedClasses() |
Set<Pattern> |
getExcludedPackageNamePatterns() |
PropertyDescriptor[] |
getPropertyDescriptors(Class clazz)
Get's the java beans property descriptors for the given class.
|
PropertyDescriptor[] |
getPropertyDescriptors(Object source)
Get's the java beans property descriptors for the given source.
|
Object |
getRealTarget(String property,
Map<String,Object> context,
Object root)
Looks for the real target with the specified property given a root Object which may be a
CompoundRoot.
|
Object |
getValue(String name,
Map<String,Object> context,
Object root) |
Object |
getValue(String name,
Map<String,Object> context,
Object root,
Class resultType) |
void |
setAllowStaticMethodAccess(String allowStaticMethodAccess) |
void |
setContainer(Container container) |
void |
setDevMode(String mode) |
void |
setEnableEvalExpression(String evalExpression) |
void |
setEnableExpressionCache(String cache) |
void |
setExcludedClasses(String commaDelimitedClasses) |
void |
setExcludedPackageName(String commaDelimitedPackagePatterns) |
void |
setProperties(Map<String,?> properties,
Object o)
Sets the properties on the object using the default context, defaulting to not throwing
exceptions for problems setting the properties.
|
void |
setProperties(Map<String,?> properties,
Object o,
boolean throwPropertyExceptions)
Sets the properties on the object using the default context.
|
void |
setProperties(Map<String,?> props,
Object o,
Map<String,Object> context)
Sets the object's properties using the default type converter, defaulting to not throw
exceptions for problems setting the properties.
|
void |
setProperties(Map<String,?> props,
Object o,
Map<String,Object> context,
boolean throwPropertyExceptions)
Sets the object's properties using the default type converter.
|
void |
setProperty(String name,
Object value,
Object o,
Map<String,Object> context)
Sets the named property to the supplied value on the Object, defaults to not throwing
property exceptions.
|
void |
setProperty(String name,
Object value,
Object o,
Map<String,Object> context,
boolean throwPropertyExceptions)
Sets the named property to the supplied value on the Object.
|
void |
setValue(String name,
Map<String,Object> context,
Object root,
Object value)
Wrapper around Ognl.setValue() to handle type conversion for collection elements.
|
protected void |
setValue(String name,
Map<String,Object> context,
Object root,
Object value,
boolean evalName) |
void |
setXWorkConverter(XWorkConverter conv) |
public void setXWorkConverter(XWorkConverter conv)
public void setDevMode(String mode)
public void setEnableExpressionCache(String cache)
public void setEnableEvalExpression(String evalExpression)
public void setExcludedClasses(String commaDelimitedClasses)
public void setExcludedPackageName(String commaDelimitedPackagePatterns)
public void setContainer(Container container)
public void setAllowStaticMethodAccess(String allowStaticMethodAccess)
public void setProperties(Map<String,?> props, Object o, Map<String,Object> context)
props
- the properties being seto
- the objectcontext
- the action contextpublic void setProperties(Map<String,?> props, Object o, Map<String,Object> context, boolean throwPropertyExceptions) throws ReflectionException
props
- the properties being seto
- the objectcontext
- the action contextthrowPropertyExceptions
- boolean which tells whether it should throw exceptions for
problems setting the propertiesReflectionException
public void setProperties(Map<String,?> properties, Object o)
properties
- o
- public void setProperties(Map<String,?> properties, Object o, boolean throwPropertyExceptions)
properties
- the property map to set on the objecto
- the object to set the properties intothrowPropertyExceptions
- boolean which tells whether it should throw exceptions for
problems setting the propertiespublic void setProperty(String name, Object value, Object o, Map<String,Object> context)
name
- the name of the property to be setvalue
- the value to set into the named propertyo
- the object upon which to set the propertycontext
- the context which may include the TypeConverterpublic void setProperty(String name, Object value, Object o, Map<String,Object> context, boolean throwPropertyExceptions)
name
- the name of the property to be setvalue
- the value to set into the named propertyo
- the object upon which to set the propertycontext
- the context which may include the TypeConverterthrowPropertyExceptions
- boolean which tells whether it should throw exceptions for
problems setting the propertypublic Object getRealTarget(String property, Map<String,Object> context, Object root) throws ognl.OgnlException
ognl.OgnlException
public void setValue(String name, Map<String,Object> context, Object root, Object value) throws ognl.OgnlException
ognl.OgnlException
protected void setValue(String name, Map<String,Object> context, Object root, Object value, boolean evalName) throws ognl.OgnlException
ognl.OgnlException
public Object getValue(String name, Map<String,Object> context, Object root) throws ognl.OgnlException
ognl.OgnlException
public Object getValue(String name, Map<String,Object> context, Object root, Class resultType) throws ognl.OgnlException
ognl.OgnlException
public Object compile(String expression) throws ognl.OgnlException
ognl.OgnlException
public Object compile(String expression, Map<String,Object> context) throws ognl.OgnlException
ognl.OgnlException
public void copy(Object from, Object to, Map<String,Object> context, Collection<String> exclusions, Collection<String> inclusions)
XWorkConverter
if none
is specified.from
- the source objectto
- the target objectcontext
- the action context we're running underexclusions
- collection of method names to excluded from copying ( can be null)inclusions
- collection of method names to included copying (can be null)
note if exclusions AND inclusions are supplied and not null nothing will get copied.public void copy(Object from, Object to, Map<String,Object> context)
XWorkConverter
if none
is specified.from
- the source objectto
- the target objectcontext
- the action context we're running underpublic PropertyDescriptor[] getPropertyDescriptors(Object source) throws IntrospectionException
source
- the source object.IntrospectionException
- is thrown if an exception occurs during introspection.public PropertyDescriptor[] getPropertyDescriptors(Class clazz) throws IntrospectionException
clazz
- the source object.IntrospectionException
- is thrown if an exception occurs during introspection.public Map<String,Object> getBeanMap(Object source) throws IntrospectionException, ognl.OgnlException
here is no read method for property-name
.source
- the source object.IntrospectionException
- is thrown if an exception occurs during introspection.ognl.OgnlException
- is thrown by OGNL if the property value could not be retrievedpublic BeanInfo getBeanInfo(Object from) throws IntrospectionException
from
- the source object.IntrospectionException
- is thrown if an exception occurs during introspection.public BeanInfo getBeanInfo(Class clazz) throws IntrospectionException
clazz
- the source class.IntrospectionException
- is thrown if an exception occurs during introspection.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.