KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jasper > el > ELContextWrapper


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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 JavaDoc;
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) return this.fnMapper;
47         return this.target.getFunctionMapper();
48     }
49
50     public VariableMapper getVariableMapper() {
51         return this.target.getVariableMapper();
52     }
53
54     public Object JavaDoc getContext(Class JavaDoc key) {
55         return this.target.getContext(key);
56     }
57
58     public Locale JavaDoc getLocale() {
59         return this.target.getLocale();
60     }
61
62     public boolean isPropertyResolved() {
63         return this.target.isPropertyResolved();
64     }
65
66     public void putContext(Class JavaDoc key, Object JavaDoc contextObject) throws NullPointerException JavaDoc {
67         this.target.putContext(key, contextObject);
68     }
69
70     public void setLocale(Locale JavaDoc locale) {
71         this.target.setLocale(locale);
72     }
73
74     public void setPropertyResolved(boolean resolved) {
75         this.target.setPropertyResolved(resolved);
76     }
77
78 }
79
Popular Tags