|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.core.util.lang.PropertyResolver
public final class PropertyResolver
NOTE: THIS CLASS IS NOT PART OF THE WICKET PUBLIC API, DO NOT USE IT UNLESS YOU KNOW WHAT YOU ARE DOING.
This class parses expressions to lookup or set a value on the object that is given.
The supported expressions are:
"property": This can can then be a bean property with get and set method. Or if a map is given as an object it will be lookup with the property as a key when there is not get method for that property.
"property1.property2": Both properties are lookup as written above. If property1 evaluates to null then if there is a setMethod (or if it is a map) and the Class of the property has a default constructor then the object will be constructed and set on the object.
"property.index": If the property is a List or Array then the second property can be a index on that list like: 'mylist.0' this expression will also map on a getProperty(index) or setProperty(index,value) methods. If the object is a List then the list will grow automatically if the index is greater then the size
Index or map properties can also be written as: "property[index]" or "property[key]"
Nested Class Summary | |
---|---|
static interface |
PropertyResolver.IClassCache
An implementation of the class can be set on the setClassCache(org.apache.wicket.Application, org.apache.wicket.core.util.lang.PropertyResolver.IClassCache)
method for a specific application. |
static interface |
PropertyResolver.IGetAndSet
|
Method Summary | ||
---|---|---|
static void |
destroy(Application application)
Clean up cache for this app. |
|
static
|
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 |
setClassCache(Application application,
PropertyResolver.IClassCache classCache)
Sets the PropertyResolver.IClassCache 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final Object getValue(String expression, Object object)
expression
- The expression string with the property to be lookup.object
- The object which is evaluated.
public static final 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.public static final Class<?> getPropertyClass(String expression, Object object)
expression
- object
-
public static <T> Class<T> getPropertyClass(String expression, Class<?> clz)
T
- expression
- clz
-
public static final Field getPropertyField(String expression, Object object)
expression
- object
-
public static final Method getPropertyGetter(String expression, Object object)
expression
- object
-
public static final Method getPropertySetter(String expression, Object object)
expression
- object
-
public static void destroy(Application application)
application
- public static void setClassCache(Application application, PropertyResolver.IClassCache classCache)
PropertyResolver.IClassCache
for the given application.
If the Application is null then it will be the default if no application is found. So if you
want to be sure that your PropertyResolver.IClassCache
is handled in all situations then call this
method twice with your implementations. One time for the application and the second time with
null.
application
- to use or null if the default must be set.classCache
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |