1 /*
2 * $Id: ValueHolder.java,v 1.20 2007/04/27 22:00:05 ofung Exp $
3 */
4
5 /*
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7 *
8 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
9 *
10 * The contents of this file are subject to the terms of either the GNU
11 * General Public License Version 2 only ("GPL") or the Common Development
12 * and Distribution License("CDDL") (collectively, the "License"). You
13 * may not use this file except in compliance with the License. You can obtain
14 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
15 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
16 * language governing permissions and limitations under the License.
17 *
18 * When distributing the software, include this License Header Notice in each
19 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
20 * Sun designates this particular file as subject to the "Classpath" exception
21 * as provided by Sun in the GPL Version 2 section of the License file that
22 * accompanied this code. If applicable, add the following below the License
23 * Header, with the fields enclosed by brackets [] replaced by your own
24 * identifying information: "Portions Copyrighted [year]
25 * [name of copyright owner]"
26 *
27 * Contributor(s):
28 *
29 * If you wish your version of this file to be governed by only the CDDL or
30 * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 * elects to include this software in this distribution under the [CDDL or GPL
32 * Version 2] license." If you don't indicate a single choice of license, a
33 * recipient has the option to distribute your version of this file under
34 * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 * its licensees as provided above. However, if you add GPL Version 2 code
36 * and therefore, elected the GPL Version 2 license, then the option applies
37 * only if the new code is made subject to such option by the copyright
38 * holder.
39 */
40
41 package javax.faces.component;
42
43
44 import javax.faces.convert.Converter;
45 import javax.el.ValueExpression;
46
47
48 /**
49 * <p><strong>ValueHolder</strong> is an interface that may be implemented
50 * by any concrete {@link UIComponent} that wishes to support a local
51 * value, as well as access data in the model tier via a <em>value
52 * expression</em>, and support conversion
53 * between String and the model tier data's native data type.
54 */
55
56 public interface ValueHolder {
57
58
59 // -------------------------------------------------------------- Properties
60
61 /**
62 * <p>Return the local value of this {@link UIComponent} (if any),
63 * without evaluating any associated {@link ValueExpression}.</p>
64 */
65 public Object getLocalValue();
66
67
68 /**
69 * <p>Gets the value of this {@link UIComponent}. First, consult
70 * the local value property of this component. If
71 * non-<code>null</code> return it. If <code>null</code>, see if we have a
72 * {@link ValueExpression} for the <code>value</code> property. If
73 * so, return the result of evaluating the property, otherwise
74 * return <code>null</code>. Note that because the specification for {@link
75 * UIComponent#setValueBinding} requires a
76 * call through to {@link UIComponent#setValueExpression}, legacy
77 * tags will continue to work.</p>
78 */
79 public Object getValue();
80
81
82 /**
83 * <p>Set the value of this {@link UIComponent} (if any).</p>
84 *
85 * @param value The new local value
86 */
87 public void setValue(Object value);
88
89
90
91 /**
92 * <p>Return the {@link Converter} (if any)
93 * that is registered for this {@link UIComponent}.</p>
94 */
95 public Converter getConverter();
96
97
98 /**
99 * <p>Set the {@link Converter} (if any)
100 * that is registered for this {@link UIComponent}.</p>
101 *
102 * @param converter New {@link Converter} (or <code>null</code>)
103 */
104 public void setConverter(Converter converter);
105 }