1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.el.convert;
20
21 import javax.el.ELException;
22 import javax.el.ELResolver;
23 import javax.el.PropertyNotFoundException;
24 import javax.faces.context.FacesContext;
25 import javax.faces.el.EvaluationException;
26 import javax.faces.el.VariableResolver;
27
28
29
30
31
32
33 public final class ELResolverToVariableResolver extends VariableResolver
34 {
35
36 private final ELResolver elResolver;
37
38
39
40
41 public ELResolverToVariableResolver(final ELResolver elResolver)
42 {
43 if (elResolver == null)
44 {
45 throw new NullPointerException();
46 }
47 this.elResolver = elResolver;
48 }
49
50 @Override
51 public Object resolveVariable(final FacesContext facesContext, final String name) throws EvaluationException
52 {
53
54 try
55 {
56 return elResolver.getValue(facesContext.getELContext(), null, name);
57 }
58 catch (PropertyNotFoundException e)
59 {
60 throw new EvaluationException(e);
61 }
62 catch (ELException e)
63 {
64 throw new EvaluationException(e);
65 }
66 }
67
68 }