KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > wap > base > ConstantMethodBinding


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.wap.base;
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 <a HREF="mailto:Jiri.Zaloudek@ivancice.cz">Jiri Zaloudek</a> (latest modification by $Author: matzew $)
26  * @version $Revision: 1.1 $ $Date: 2004/12/30 09:37:27 $
27  * $Log: ConstantMethodBinding.java,v $
28  * Revision 1.1 2004/12/30 09:37:27 matzew
29  * added a new RenderKit for WML. Thanks to Jirí Žaloudek
30  *
31  */

32 public class ConstantMethodBinding extends MethodBinding implements StateHolder {
33     private String JavaDoc outCome;
34     private boolean _transient;
35     
36     /** Creates a new instance of ConstantMethodBinding */
37     public ConstantMethodBinding() {
38     }
39     
40     public ConstantMethodBinding(String JavaDoc outCome) {
41         this.outCome = outCome;
42     }
43
44     public Class JavaDoc getType(FacesContext facesContext) throws MethodNotFoundException {
45         return(String JavaDoc.class);
46     }
47     
48     public Object JavaDoc invoke(FacesContext facesContext, Object JavaDoc[] obj) throws EvaluationException, MethodNotFoundException {
49         return(outCome);
50     }
51     
52     
53     public void restoreState(FacesContext facesContext, Object JavaDoc obj) {
54         this.outCome = (String JavaDoc)obj;
55     }
56
57     public Object JavaDoc saveState(FacesContext facesContext) {
58         return(outCome);
59     }
60
61     public boolean isTransient() {
62         return _transient;
63     }
64
65     public void setTransient(boolean _transient) {
66         this._transient = _transient;
67     }
68 }
69
Popular Tags