KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > el > SimpleActionMethodBinding


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.el;
17
18 import javax.faces.component.StateHolder;
19 import javax.faces.context.FacesContext;
20 import javax.faces.el.EvaluationException;
21 import javax.faces.el.MethodBinding;
22 import javax.faces.el.MethodNotFoundException;
23
24 /**
25  * @author Manfred Geiler (latest modification by $Author: matze $)
26  * @version $Revision: 1.3 $ $Date: 2004/10/13 11:51:01 $
27  */

28 public class SimpleActionMethodBinding
29         extends MethodBinding
30         implements StateHolder
31 {
32     //private static final Log log = LogFactory.getLog(SimpleActionMethodBinding.class);
33

34     private String JavaDoc _outcome;
35
36     public SimpleActionMethodBinding(String JavaDoc outcome)
37     {
38         _outcome = outcome;
39     }
40
41     public Object JavaDoc invoke(FacesContext facescontext, Object JavaDoc aobj[]) throws EvaluationException, MethodNotFoundException
42     {
43         return _outcome;
44     }
45
46     public Class JavaDoc getType(FacesContext facescontext) throws MethodNotFoundException
47     {
48         return String JavaDoc.class;
49     }
50
51
52     //~ StateHolder support ----------------------------------------------------------------------------
53

54     private boolean _transient = false;
55
56     /**
57      * Empty constructor, so that new instances can be created when restoring state.
58      */

59     public SimpleActionMethodBinding()
60     {
61         _outcome = null;
62     }
63
64     public Object JavaDoc saveState(FacesContext facescontext)
65     {
66         return _outcome;
67     }
68
69     public void restoreState(FacesContext facescontext, Object JavaDoc obj)
70     {
71         _outcome = (String JavaDoc)obj;
72     }
73
74     public boolean isTransient()
75     {
76         return _transient;
77     }
78
79     public void setTransient(boolean flag)
80     {
81         _transient = flag;
82     }
83 }
84
Popular Tags