1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.custom.facelets.tag;
20
21 import java.io.Serializable;
22
23 import javax.el.ELException;
24 import javax.el.MethodExpression;
25 import javax.faces.context.FacesContext;
26 import javax.faces.el.EvaluationException;
27 import javax.faces.el.MethodBinding;
28 import javax.faces.el.MethodNotFoundException;
29
30 public final class LegacyMethodBinding extends MethodBinding implements
31 Serializable
32 {
33
34 private static final long serialVersionUID = 1L;
35
36 private final MethodExpression m;
37
38 public LegacyMethodBinding(MethodExpression m)
39 {
40 this.m = m;
41 }
42
43 public Class getType(FacesContext context) throws MethodNotFoundException
44 {
45 try
46 {
47 return m.getMethodInfo(context.getELContext()).getReturnType();
48 }
49 catch (javax.el.MethodNotFoundException e)
50 {
51 throw new MethodNotFoundException(e.getMessage(), e.getCause());
52 }
53 catch (ELException e)
54 {
55 throw new EvaluationException(e.getMessage(), e.getCause());
56 }
57 }
58
59 public Object invoke(FacesContext context, Object[] params)
60 throws EvaluationException, MethodNotFoundException
61 {
62 try
63 {
64 return m.invoke(context.getELContext(), params);
65 }
66 catch (javax.el.MethodNotFoundException e)
67 {
68 throw new MethodNotFoundException(e.getMessage(), e.getCause());
69 }
70 catch (ELException e)
71 {
72 throw new EvaluationException(e.getMessage(), e.getCause());
73 }
74 }
75
76 public String getExpressionString()
77 {
78 return m.getExpressionString();
79 }
80 }