01: /*
02: * Copyright 2006 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.apache.myfaces.el;
18:
19: import javax.el.ELContext;
20: import javax.faces.context.FacesContext;
21: import javax.faces.el.EvaluationException;
22: import javax.faces.el.PropertyNotFoundException;
23: import javax.faces.el.PropertyResolver;
24:
25: /**
26: * Default PropertyResolver. See JSF 1.2 spec section 5.8.2
27: *
28: * @author Stan Silvert
29: */
30: public class NullPropertyResolver extends PropertyResolver {
31:
32: /** Creates a new instance of NullPropertyResolver */
33: public NullPropertyResolver() {
34: }
35:
36: public boolean isReadOnly(Object base, int index)
37: throws EvaluationException, PropertyNotFoundException {
38: elContext().setPropertyResolved(false);
39: return false;
40: }
41:
42: public boolean isReadOnly(Object base, Object property)
43: throws EvaluationException, PropertyNotFoundException {
44: elContext().setPropertyResolved(false);
45: return false;
46: }
47:
48: public Object getValue(Object base, int index)
49: throws EvaluationException, PropertyNotFoundException {
50: elContext().setPropertyResolved(false);
51: return null;
52: }
53:
54: public Object getValue(Object base, Object property)
55: throws EvaluationException, PropertyNotFoundException {
56: elContext().setPropertyResolved(false);
57: return null;
58: }
59:
60: public Class getType(Object base, int index)
61: throws EvaluationException, PropertyNotFoundException {
62: elContext().setPropertyResolved(false);
63: return null;
64: }
65:
66: public Class getType(Object base, Object property)
67: throws EvaluationException, PropertyNotFoundException {
68: elContext().setPropertyResolved(false);
69: return null;
70: }
71:
72: public void setValue(Object base, Object property, Object value)
73: throws EvaluationException, PropertyNotFoundException {
74: elContext().setPropertyResolved(false);
75: }
76:
77: public void setValue(Object base, int index, Object value)
78: throws EvaluationException, PropertyNotFoundException {
79: elContext().setPropertyResolved(false);
80: }
81:
82: private ELContext elContext() {
83: return FacesContext.getCurrentInstance().getELContext();
84: }
85:
86: }
|