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.trinidad.bean;
20  
21  import javax.faces.component.StateHolder;
22  import javax.faces.context.FacesContext;
23  import javax.faces.el.ValueBinding;
24  
25  public class TestValueBinding extends ValueBinding implements StateHolder
26  {
27    public TestValueBinding()
28    {
29    }
30  
31    @Override
32    public Object getValue(FacesContext context)
33    {
34      return _value;
35    }
36  
37    @Override
38    public void setValue(FacesContext context, Object value)
39    {
40      _value = value;
41    }
42  
43    @Override
44    public boolean isReadOnly(FacesContext context)
45    {
46      return false;
47    }
48  
49    @Override
50    public Class<?> getType(FacesContext context)
51    {
52      return null;
53    }
54  
55    public Object saveState(FacesContext context)
56    {
57      return _value;
58    }
59  
60    public void restoreState(FacesContext context, Object state)
61    {
62      _value = state;
63    }
64  
65    public boolean isTransient()
66    {
67      return _transient;
68    }
69  
70    public void setTransient(boolean newTransientValue)
71    {
72      _transient = newTransientValue;
73    }
74  
75    private boolean _transient;
76    private Object _value;
77  }