public final class PropertyResolver extends Object
This expression will also map on indexed properties, i.e. getProperty(index)
and setProperty(index,value)
methods.
PropertyResolver.DefaultPropertyLocator
by default provides access to private members
and methods. If guaranteeing encapsulation of the target objects is a big concern, you should consider
using an alternative implementation.
Note: If a property evaluates to an instance of IModel
then
the expression should use '.object' to work with its value.
Modifier and Type | Class and Description |
---|---|
static class |
PropertyResolver.AbstractGetAndSet |
static class |
PropertyResolver.CachingPropertyLocator
A wrapper for another
PropertyResolver.IPropertyLocator that caches results of PropertyResolver.CachingPropertyLocator.get(Class, String) . |
static class |
PropertyResolver.DefaultPropertyLocator
Default locator supporting Java Beans properties, maps, lists and method invocations.
|
static interface |
PropertyResolver.IGetAndSet
A property to get and set.
|
static interface |
PropertyResolver.IPropertyLocator
A locator of properties.
|
Modifier and Type | Method and Description |
---|---|
static void |
destroy(Application application)
Clean up cache for this app.
|
static PropertyResolver.IPropertyLocator |
getLocator()
Get the current
PropertyResolver.IPropertyLocator . |
static <T> Class<T> |
getPropertyClass(String expression,
Class<?> clz) |
static Class<?> |
getPropertyClass(String expression,
Object object) |
static Field |
getPropertyField(String expression,
Object object) |
static Method |
getPropertyGetter(String expression,
Object object) |
static Method |
getPropertySetter(String expression,
Object object) |
static Object |
getValue(String expression,
Object object)
Looks up the value from the object with the given expression.
|
static void |
setLocator(Application application,
PropertyResolver.IPropertyLocator locator)
Set a locator for the given application.
|
static void |
setValue(String expression,
Object object,
Object value,
PropertyResolverConverter converter)
Set the value on the object with the given expression.
|
public static Object getValue(String expression, Object object)
expression
- The expression string with the property to be lookup.object
- The object which is evaluated.public static void setValue(String expression, Object object, Object value, PropertyResolverConverter converter)
expression
- The expression string with the property to be set.object
- The object which is evaluated to set the value on.value
- The value to set.converter
- The converter to convert the value if needed to the right type.WicketRuntimeException
public static Class<?> getPropertyClass(String expression, Object object)
expression
- object
- WicketRuntimeException
- if the cannot be resolvedpublic static <T> Class<T> getPropertyClass(String expression, Class<?> clz)
T
- expression
- clz
- WicketRuntimeException
- if class cannot be resolvedpublic static Field getPropertyField(String expression, Object object)
expression
- object
- WicketRuntimeException
- if there is no such fieldpublic static Method getPropertyGetter(String expression, Object object)
expression
- object
- WicketRuntimeException
- if there is no getter methodpublic static Method getPropertySetter(String expression, Object object)
expression
- object
- WicketRuntimeException
- if there is no setter methodpublic static void destroy(Application application)
application
- public static PropertyResolver.IPropertyLocator getLocator()
PropertyResolver.IPropertyLocator
.Application
or a general one if no current application is presentApplication.get()
public static void setLocator(Application application, PropertyResolver.IPropertyLocator locator)
application
- application, may be null
locator
- locatorCopyright © 2006–2022 Apache Software Foundation. All rights reserved.