public class OgnlUtil extends Object
| 构造器和说明 |
|---|
OgnlUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Object |
compile(String expression) |
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
JDSMethodAccessor if none
is specified. |
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
JDSMethodAccessor if none
is specified. |
static BeanInfo |
getBeanInfo(Object from)
Get's the java bean info for the given source.
|
static Map |
getBeanMap(Object source)
Creates a Map with read properties for the given source object.
|
static PropertyDescriptor[] |
getPropertyDescriptors(Object source)
Get's the java beans property descriptors for the given source.
|
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.
|
static Object |
getValue(String name,
Map context,
Object root) |
static <T> T |
getValue(String name,
Map context,
Object root,
Class<T> resultType) |
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.
|
static void |
setProperties(Map properties,
Object o,
boolean throwPropertyExceptions)
Sets the properties on the object using the default context.
|
static void |
setProperties(Map properties,
Object o,
boolean throwPropertyExceptions,
boolean throwwarn) |
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.
|
static void |
setProperties(Map props,
Object o,
Map context,
boolean throwPropertyExceptions,
boolean throwwarn)
Sets the object's properties using the default type converter.
|
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.
|
static void |
setProperty(String name,
Object value,
Object o,
Map context,
boolean throwPropertyExceptions) |
static void |
setProperty(String name,
Object value,
Object o,
Map context,
boolean throwPropertyExceptions,
boolean throwwarn)
Sets the named property to the supplied value on the Object.
|
static void |
setValue(String name,
Map context,
Object root,
Object value)
Wrapper around Ognl.setValue() to handle type conversion for collection elements.
|
public static void setProperties(Map props, Object o, Map context)
props - the properties being seto - the objectcontext - the action contextpublic static void setProperties(Map props, Object o, Map context, boolean throwPropertyExceptions, boolean throwwarn)
props - the properties being seto - the objectcontext - the action contextthrowPropertyExceptions - boolean which tells whether it should throw exceptions for
problems setting the propertiespublic static void setProperties(Map properties, Object o)
properties - o - public static void setProperties(Map 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 static void setProperties(Map properties, Object o, boolean throwPropertyExceptions, boolean throwwarn)
public static void setProperty(String name, Object value, Object o, Map 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 static void setProperty(String name, Object value, Object o, Map context, boolean throwPropertyExceptions)
public static void setProperty(String name, Object value, Object o, Map context, boolean throwPropertyExceptions, boolean throwwarn)
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 static Object getRealTarget(String property, Map context, Object root) throws ognl.OgnlException
ognl.OgnlExceptionpublic static void setValue(String name, Map context, Object root, Object value) throws ognl.OgnlException
ognl.OgnlExceptionpublic static Object getValue(String name, Map context, Object root) throws ognl.OgnlException
ognl.OgnlExceptionpublic static <T> T getValue(String name, Map context, Object root, Class<T> resultType) throws ognl.OgnlException
ognl.OgnlExceptionpublic static Object compile(String expression) throws ognl.OgnlException
ognl.OgnlExceptionpublic static void copy(Object from, Object to, Map context, Collection exclusions, Collection inclusions)
JDSMethodAccessor 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 static void copy(Object from, Object to, Map context)
JDSMethodAccessor if none
is specified.from - the source objectto - the target objectcontext - the action context we're running underpublic static PropertyDescriptor[] getPropertyDescriptors(Object source) throws IntrospectionException
source - the source object.IntrospectionException - is thrown if an exception occurs during introspection.public static Map 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 static BeanInfo getBeanInfo(Object from) throws IntrospectionException
from - the source object.IntrospectionException - is thrown if an exception occurs during introspection.Copyright © 2023 onecode. All rights reserved.