| java.lang.Object com.opensymphony.xwork.util.OgnlUtil
OgnlUtil | public class OgnlUtil (Code) | | Utility class that provides common access to the Ognl APIs for
setting and getting properties from objects (usually Actions).
author: Jason Carreira author: tmjee version: $Date: 2007-07-15 05:56:02 +0200 (Sun, 15 Jul 2007) $ $Id: OgnlUtil.java 1542 2007-07-15 03:56:02Z tm_jee $ |
Method Summary | |
public static Object | compile(String expression) | public static void | copy(Object from, Object to, Map context, Collection exclusions, Collection inclusions) Copies the properties in the object "from" and sets them in the object "to"
using specified type converter, or
com.opensymphony.xwork.util.XWorkConverter if none
is specified. | public static void | copy(Object from, Object to, Map context) Copies the properties in the object "from" and sets them in the object "to"
using specified type converter, or
com.opensymphony.xwork.util.XWorkConverter if none
is specified. | public static BeanInfo | getBeanInfo(Object from) Get's the java bean info for the given source.
Parameters: from - the source object. | public static Map | getBeanMap(Object source) Creates a Map with read properties for the given source object.
If the source object does not have a read property (i.e. | public static PropertyDescriptor[] | getPropertyDescriptors(Object source) Get's the java beans property descriptors for the given source.
Parameters: source - the source object. | public static Object | getRealTarget(String property, Map context, Object root) Looks for the real target with the specified property given a root Object which may be a
CompoundRoot. | public static Object | getValue(String name, Map context, Object root) | public static Object | getValue(String name, Map context, Object root, Class resultType) | static void | internalSetProperty(String name, Object value, Object o, Map context, boolean throwPropertyExceptions) | public static void | setProperties(Map props, Object o, Map context) Sets the object's properties using the default type converter, defaulting to not throw
exceptions for problems setting the properties. | public static void | setProperties(Map props, Object o, Map context, boolean throwPropertyExceptions) Sets the object's properties using the default type converter. | public static void | setProperties(Map properties, Object o) Sets the properties on the object using the default context, defaulting to not throwing
exceptions for problems setting the properties. | public static void | setProperties(Map properties, Object o, boolean throwPropertyExceptions) Sets the properties on the object using the default context. | public static void | setProperty(String name, Object value, Object o, Map context) Sets the named property to the supplied value on the Object, defaults to not throwing
property exceptions. | public static void | setProperty(String name, Object value, Object o, Map context, boolean throwPropertyExceptions) Sets the named property to the supplied value on the Object. | public static void | setValue(String name, Map context, Object root, Object value) Wrapper around Ognl.setValue() to handle type conversion for collection elements. |
copy | public static void copy(Object from, Object to, Map context, Collection exclusions, Collection inclusions)(Code) | | Copies the properties in the object "from" and sets them in the object "to"
using specified type converter, or
com.opensymphony.xwork.util.XWorkConverter if none
is specified.
Parameters: from - the source object Parameters: to - the target object Parameters: context - the action context we're running under Parameters: exclusions - collection of method names to excluded from copying ( can be null) Parameters: 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. |
copy | public static void copy(Object from, Object to, Map context)(Code) | | Copies the properties in the object "from" and sets them in the object "to"
using specified type converter, or
com.opensymphony.xwork.util.XWorkConverter if none
is specified.
Parameters: from - the source object Parameters: to - the target object Parameters: context - the action context we're running under |
getBeanMap | public static Map getBeanMap(Object source) throws IntrospectionException, OgnlException(Code) | | Creates a Map with read properties for the given source object.
If the source object does not have a read property (i.e. write-only) then
the property is added to the map with the value here is no read method for property-name .
Parameters: source - the source object. a Map with (key = read property name, value = value of read property). throws: IntrospectionException - is thrown if an exception occurs during introspection. throws: OgnlException - is thrown by OGNL if the property value could not be retrieved |
getRealTarget | public static Object getRealTarget(String property, Map context, Object root) throws OgnlException(Code) | | Looks for the real target with the specified property given a root Object which may be a
CompoundRoot.
the real target or null if no object can be found with the specified property |
internalSetProperty | static void internalSetProperty(String name, Object value, Object o, Map context, boolean throwPropertyExceptions)(Code) | | |
setProperties | public static void setProperties(Map props, Object o, Map context)(Code) | | Sets the object's properties using the default type converter, defaulting to not throw
exceptions for problems setting the properties.
Parameters: props - the properties being set Parameters: o - the object Parameters: context - the action context |
setProperties | public static void setProperties(Map props, Object o, Map context, boolean throwPropertyExceptions)(Code) | | Sets the object's properties using the default type converter.
Parameters: props - the properties being set Parameters: o - the object Parameters: context - the action context Parameters: throwPropertyExceptions - boolean which tells whether it should throw exceptions forproblems setting the properties |
setProperties | public static void setProperties(Map properties, Object o)(Code) | | Sets the properties on the object using the default context, defaulting to not throwing
exceptions for problems setting the properties.
Parameters: properties - Parameters: o - |
setProperties | public static void setProperties(Map properties, Object o, boolean throwPropertyExceptions)(Code) | | Sets the properties on the object using the default context.
Parameters: properties - the property map to set on the object Parameters: o - the object to set the properties into Parameters: throwPropertyExceptions - boolean which tells whether it should throw exceptions forproblems setting the properties |
setProperty | public static void setProperty(String name, Object value, Object o, Map context)(Code) | | Sets the named property to the supplied value on the Object, defaults to not throwing
property exceptions.
Parameters: name - the name of the property to be set Parameters: value - the value to set into the named property Parameters: o - the object upon which to set the property Parameters: context - the context which may include the TypeConverter |
setProperty | public static void setProperty(String name, Object value, Object o, Map context, boolean throwPropertyExceptions)(Code) | | Sets the named property to the supplied value on the Object.
Parameters: name - the name of the property to be set Parameters: value - the value to set into the named property Parameters: o - the object upon which to set the property Parameters: context - the context which may include the TypeConverter Parameters: throwPropertyExceptions - boolean which tells whether it should throw exceptions forproblems setting the property |
setValue | public static void setValue(String name, Map context, Object root, Object value) throws OgnlException(Code) | | Wrapper around Ognl.setValue() to handle type conversion for collection elements.
Ideally, this should be handled by OGNL directly.
|
|
|