Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CompositeVariableMapper |
|
| 1.6666666666666667;1.667 |
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 org.apache.myfaces.view.facelets.el; | |
20 | ||
21 | import javax.el.ValueExpression; | |
22 | import javax.el.VariableMapper; | |
23 | ||
24 | /** | |
25 | * Composite VariableMapper that attempts to load the ValueExpression from the first VariableMapper, then the second if | |
26 | * <code>null</code>. | |
27 | * | |
28 | * @see javax.el.VariableMapper | |
29 | * @see javax.el.ValueExpression | |
30 | * | |
31 | * @author Jacob Hookom | |
32 | * @version $Id$ | |
33 | */ | |
34 | public final class CompositeVariableMapper extends VariableMapper | |
35 | { | |
36 | ||
37 | private final VariableMapper var0; | |
38 | ||
39 | private final VariableMapper var1; | |
40 | ||
41 | public CompositeVariableMapper(VariableMapper var0, VariableMapper var1) | |
42 | 0 | { |
43 | 0 | this.var0 = var0; |
44 | 0 | this.var1 = var1; |
45 | 0 | } |
46 | ||
47 | /** | |
48 | * @see javax.el.VariableMapper#resolveVariable(java.lang.String) | |
49 | */ | |
50 | public ValueExpression resolveVariable(String name) | |
51 | { | |
52 | 0 | ValueExpression ve = this.var0.resolveVariable(name); |
53 | 0 | if (ve == null) |
54 | { | |
55 | 0 | return this.var1.resolveVariable(name); |
56 | } | |
57 | 0 | return ve; |
58 | } | |
59 | ||
60 | /** | |
61 | * @see javax.el.VariableMapper#setVariable(java.lang.String, javax.el.ValueExpression) | |
62 | */ | |
63 | public ValueExpression setVariable(String name, ValueExpression expression) | |
64 | { | |
65 | 0 | return this.var0.setVariable(name, expression); |
66 | } | |
67 | ||
68 | } |