KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > jxpath > DynamicPropertyHandler


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
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 JavaDoc[] getPropertyNames(Object JavaDoc object);
45
46     /**
47      * Returns the value of the specified dynamic property.
48      */

49     Object JavaDoc getProperty(Object JavaDoc object, String JavaDoc propertyName);
50
51     /**
52      * Modifies the value of the specified dynamic property.
53      */

54     void setProperty(Object JavaDoc object, String JavaDoc propertyName, Object JavaDoc value);
55 }
Popular Tags