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 javax.faces.component;
20
21
22 /**
23 * <p>Define a <code>Map</code>-like contract
24 * that makes it easier for components to implement {@link
25 * TransientStateHolder}. Each {@link UIComponent} in the view will
26 * return an implementation of this interface from its {@link
27 * UIComponent#getTransientStateHelper} method.</p>
28 *
29 * <p>The values retrieved or saved through
30 * {@link #getTransient(java.io.Serializable)} } or
31 * {@link #putTransient(java.io.Serializable, Object value)} }
32 * will not be preserved between requests.</p>
33 *
34 * @since 2.1
35 * @author Leonardo Uribe (latest modification by $Author: bommel $)
36 * @version $Revision: 1187701 $ $Date: 2011-10-22 07:21:54 -0500 (Sat, 22 Oct 2011) $
37 */
38 public interface TransientStateHelper extends TransientStateHolder
39 {
40 /**
41 * <p>Return the value currently
42 * associated with the specified <code>key</code> if any.</p>
43 *
44 * @param key the key for which the value should be returned.
45 * @since 2.1
46 */
47 public Object getTransient(Object key);
48
49 /**
50 * <p>Performs the same logic as {@link
51 * #getTransient(java.io.Serializable)} } but if no value is found, this
52 * will return the specified <code>defaultValue</code></p>
53
54 * @param key the key for which the value should be returned.
55 * @param defaultValue the value to return if no value is found in
56 * the call to <code>get()</code>.
57 * @since 2.1
58 */
59 public Object getTransient(Object key, Object defaultValue);
60
61 /**
62 * <p>Return the previously stored value
63 * and store the specified key/value pair. This is intended to
64 * store data that would otherwise reside in an instance variable on
65 * the component.</p>
66 *
67 * @param key the key for the value
68 * @param value the value
69 * @since 2.1
70 */
71 public Object putTransient(Object key, Object value);
72
73 }