1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jxpath;
17
18 /***
19 * A generic mechanism for accessing collections of name/value pairs.
20 * Examples of such collections are HashMap, Properties,
21 * ServletContext. In order to add support for a new such collection
22 * type to JXPath, perform the following two steps:
23 * <ol>
24 * <li>Build an implementation of the DynamicPropertyHandler interface
25 * for the desired collection type.</li>
26 * <li>Invoke the static method {@link JXPathIntrospector#registerDynamicClass
27 * JXPathIntrospector.registerDynamicClass(class, handlerClass)}</li>
28 * </ol>
29 * JXPath allows access to dynamic properties using these three formats:
30 * <ul>
31 * <li><code>"myMap/myKey"</code></li>
32 * <li><code>"myMap[@name = 'myKey']"</code></li>
33 * <li><code>"myMap[name(.) = 'myKey']"</code></li>
34 * </ul>
35 *
36 * @author Dmitri Plotnikov
37 * @version $Revision: 1.5 $ $Date: 2004/02/29 14:17:42 $
38 */
39 public interface DynamicPropertyHandler {
40
41 /***
42 * Returns a list of dynamic property names for the supplied object.
43 */
44 String[] getPropertyNames(Object object);
45
46 /***
47 * Returns the value of the specified dynamic property.
48 */
49 Object getProperty(Object object, String propertyName);
50
51 /***
52 * Modifies the value of the specified dynamic property.
53 */
54 void setProperty(Object object, String propertyName, Object value);
55 }