01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jasper.el;
18:
19: import java.util.Locale;
20:
21: import javax.el.ELContext;
22: import javax.el.ELResolver;
23: import javax.el.FunctionMapper;
24: import javax.el.VariableMapper;
25:
26: /**
27: * Simple ELContextWrapper for runtime evaluation of EL w/ dynamic FunctionMappers
28: *
29: * @author jhook
30: */
31: public final class ELContextWrapper extends ELContext {
32:
33: private final ELContext target;
34: private final FunctionMapper fnMapper;
35:
36: public ELContextWrapper(ELContext target, FunctionMapper fnMapper) {
37: this .target = target;
38: this .fnMapper = fnMapper;
39: }
40:
41: public ELResolver getELResolver() {
42: return this .target.getELResolver();
43: }
44:
45: public FunctionMapper getFunctionMapper() {
46: if (this .fnMapper != null)
47: return this .fnMapper;
48: return this .target.getFunctionMapper();
49: }
50:
51: public VariableMapper getVariableMapper() {
52: return this .target.getVariableMapper();
53: }
54:
55: public Object getContext(Class key) {
56: return this .target.getContext(key);
57: }
58:
59: public Locale getLocale() {
60: return this .target.getLocale();
61: }
62:
63: public boolean isPropertyResolved() {
64: return this .target.isPropertyResolved();
65: }
66:
67: public void putContext(Class key, Object contextObject)
68: throws NullPointerException {
69: this .target.putContext(key, contextObject);
70: }
71:
72: public void setLocale(Locale locale) {
73: this .target.setLocale(locale);
74: }
75:
76: public void setPropertyResolved(boolean resolved) {
77: this.target.setPropertyResolved(resolved);
78: }
79:
80: }
|