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, Arrays and Lists. This class is used by
23   * such things as the ValueBinding implementation and the ManagedBeanBuilder to access JSF beans.
24   * 
25   * See the javadoc of the <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF
26   * Specification</a> for more details.
27   * 
28   * @deprecated
29   */
30  public abstract class PropertyResolver
31  {
32  
33      /**
34       * @deprecated
35       */
36      public PropertyResolver()
37      {
38      }
39  
40      /**
41       * Returns the datatype of the specified element within a list or array.
42       * <p>
43       * Param base must be of type Array or List.
44       * 
45       * @deprecated
46       */
47      public abstract Class getType(Object base, int index) throws EvaluationException, PropertyNotFoundException;
48  
49      /**
50       * Returns the datatype of the specified javabean property on the specified object.
51       * <p>
52       * Param base may be a map, in which case param property is used as a key into the map, and the type of the object
53       * with that key is returned. If there is no such key in the map, then Object.class is returned.
54       * <p>
55       * Otherwise java.beans.Introspector is used to determine the actual property type. If the base bean has no such
56       * property then a PropertyNotFoundException is thrown.
57       * 
58       * @param base
59       *            must not be null.
60       * @param property
61       *            must be of type String, must not be null and must not be an empty string.
62       * @deprecated
63       */
64      @SuppressWarnings("unchecked")
65      public abstract Class getType(Object base, java.lang.Object property) throws EvaluationException,
66          PropertyNotFoundException;
67  
68      /**
69       * Return the specified element from a list or array.
70       * <p>
71       * Param base must be of type Array or List. When the array is of a primitive type, the appropriate wrapper is
72       * returned.
73       * <p>
74       * Null is returned when param index is "out of bounds" for the provided base object.
75       * 
76       * @throws ReferenceSyntaxException
77       *             if the base object is not an Array or List.
78       * @deprecated
79       */
80      public abstract Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException;
81  
82      /**
83       * Return the current value of the specified property on the base object.
84       * <p>
85       * If base is a Map, then Map.get(property) is returned. Null is returned if there is no entry with that key.
86       * <p>
87       * Otherwise, java.beans.Introspector is applied to the base object to find the associated PropertyDescriptor and
88       * the specified read method is invoked.
89       * 
90       * @throws PropertyNotFoundException
91       *             if the provided object does not have the specified property.
92       * @deprecated
93       */
94      public abstract Object getValue(Object base, java.lang.Object property) throws EvaluationException,
95          PropertyNotFoundException;
96  
97      /**
98       * @deprecated
99       */
100     public abstract boolean isReadOnly(Object base, int index) throws EvaluationException, PropertyNotFoundException;
101 
102     /**
103      * @deprecated
104      */
105     public abstract boolean isReadOnly(Object base, java.lang.Object property) throws EvaluationException,
106         PropertyNotFoundException;
107 
108     /**
109      * Replace the object at the specified index within the base collection with the provided value.
110      * <p>
111      * Param base is expected to be an Array or List object.
112      * 
113      * @throws EvaluationException
114      *             if the base object is not an Array or List.
115      * @throws PropertyNotFoundException
116      *             if the index is "out of bounds".
117      * 
118      * @deprecated
119      */
120     public abstract void setValue(Object base, int index, java.lang.Object value) throws EvaluationException,
121         PropertyNotFoundException;
122 
123     /**
124      * Set the named property on the base object to the provided value.
125      * 
126      * @deprecated
127      */
128     public abstract void setValue(Object base, Object property, java.lang.Object value) throws EvaluationException,
129         PropertyNotFoundException;
130 }