View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package javax.faces.el;
20  
21  /**
22   * Provides methods to read, write and inspect properties of javabeans, Maps,
23   * Arrays and Lists. This class is used by such things as the ValueBinding
24   * implementation and the ManagedBeanBuilder to access JSF beans.
25   *
26   * See the javadoc of the <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
27   * for more details.
28   *
29   * @author Thomas Spiegl (latest modification by $Author: skitching $)
30   * @version $Revision: 676298 $ $Date: 2008-07-13 05:31:48 -0500 (Sun, 13 Jul 2008) $
31   * @deprecated
32   */
33  public abstract class PropertyResolver
34  {
35  
36      /**
37       * @deprecated
38       */
39      public PropertyResolver()
40      {
41      }
42      
43      /**
44       * Returns the datatype of the specified element within a list or array.
45       * <p>
46       * Param base must be of type Array or List.
47       *
48       * @deprecated
49       */
50      public abstract Class getType(Object base, int index)
51          throws EvaluationException, PropertyNotFoundException;
52  
53      /**
54       * Returns the datatype of the specified javabean property on the
55       * specified object.
56       * <p>
57       * Param base may be a map, in which case param property is used
58       * as a key into the map, and the type of the object with that key
59       * is returned. If there is no such key in the map, then Object.class
60       * is returned.
61       * <p>
62       * Otherwise java.beans.Introspector is used to determine the actual
63       * property type. If the base bean has no such property then a
64       * PropertyNotFoundException is thrown.
65       * 
66       * @param base must not be null.
67       * @param property must be of type String, must not be null and
68       *  must not be an empty string.
69       * @deprecated
70       */
71      public abstract Class getType(Object base, java.lang.Object property)
72          throws EvaluationException, PropertyNotFoundException;
73  
74      /**
75       * Return the specified element from a list or array.
76       * <p>
77       * Param base must be of type Array or List. When the array is of a
78       * primitive type, the appropriate wrapper is returned.
79       * <p>
80       * Null is returned when param index is "out of bounds" for the provided
81       * base object.
82       *  
83       * @throws ReferenceSyntaxException if the base object is not an Array
84       * or List.
85       * @deprecated
86       */
87      public abstract Object getValue(Object base, int index)
88          throws EvaluationException, PropertyNotFoundException;
89  
90      /**
91       * Return the current value of the specified property on the base
92       * object.
93       * <p>
94       * If base is a Map, then Map.get(property) is returned. Null is
95       * returned if there is no entry with that key.
96       * <p>
97       * Otherwise, java.beans.Introspector is applied to the base object
98       * to find the associated PropertyDescriptor and the specified
99       * read method is invoked.
100      * 
101      * @throws PropertyNotFoundException if the provided object does
102      * not have the specified property.
103      * @deprecated
104      */
105     public abstract Object getValue(Object base, java.lang.Object property)
106         throws EvaluationException, PropertyNotFoundException;
107 
108     /**
109      * @deprecated
110      */
111     public abstract boolean isReadOnly(Object base, int index)
112         throws EvaluationException, PropertyNotFoundException;
113 
114     /**
115      * @deprecated
116      */
117     public abstract boolean isReadOnly(Object base, java.lang.Object property)
118         throws EvaluationException, PropertyNotFoundException;
119 
120     /**
121      * Replace the object at the specified index within the base collection
122      * with the provided value.
123      * <p>
124      * Param base is expected to be an Array or List object.
125      * 
126      * @throws EvaluationException if the base object is not an Array or List.
127      * @throws PropertyNotFoundException if the index is "out of bounds".
128      *
129      * @deprecated
130      */
131     public abstract void setValue(Object base, int index, java.lang.Object value)
132         throws EvaluationException, PropertyNotFoundException;
133 
134     /**
135      * Set the named property on the base object to the provided value.
136      *
137      * @deprecated
138      */
139     public abstract void setValue(Object base, Object property, java.lang.Object value)
140         throws EvaluationException, PropertyNotFoundException;
141 }