Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LabelValueBean |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2001,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 | ||
17 | package org.apache.commons.scaffold.util; | |
18 | ||
19 | ||
20 | /** | |
21 | * Simple JavaBean to represent label-value pairs for use in collections | |
22 | * that are utilized by the <code><form:options></code> tag. | |
23 | * <p> | |
24 | * If you are also use Struts 1.1 or later, you may prefer to use the | |
25 | * [<code>org.apache.struts.util.LabelValueBean</code>] class instead. | |
26 | * The classes are identical. | |
27 | * | |
28 | * @author Craig R. McClanahan | |
29 | * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $ | |
30 | */ | |
31 | ||
32 | public class LabelValueBean { | |
33 | ||
34 | ||
35 | // ----------------------------------------------------------- Constructors | |
36 | ||
37 | ||
38 | /** | |
39 | * Construct a new LabelValueBean with the specified values. | |
40 | * | |
41 | * @param label The label to be displayed to the user | |
42 | * @param value The value to be returned to the server | |
43 | */ | |
44 | 0 | public LabelValueBean(String label, String value) { |
45 | 0 | this.label = label; |
46 | 0 | this.value = value; |
47 | 0 | } |
48 | ||
49 | ||
50 | // ------------------------------------------------------------- Properties | |
51 | ||
52 | ||
53 | /** | |
54 | * The label to be displayed to the user. | |
55 | */ | |
56 | 0 | protected String label = null; |
57 | ||
58 | public String getLabel() { | |
59 | 0 | return (this.label); |
60 | } | |
61 | ||
62 | ||
63 | /** | |
64 | * The value to be returned to the server. | |
65 | */ | |
66 | 0 | protected String value = null; |
67 | ||
68 | public String getValue() { | |
69 | 0 | return (this.value); |
70 | } | |
71 | ||
72 | ||
73 | // --------------------------------------------------------- Public Methods | |
74 | ||
75 | ||
76 | /** | |
77 | * Return a string representation of this object. | |
78 | */ | |
79 | public String toString() { | |
80 | 0 | StringBuffer sb = new StringBuffer("LabelValueBean["); |
81 | 0 | sb.append(this.label); |
82 | 0 | sb.append(", "); |
83 | 0 | sb.append(this.value); |
84 | 0 | sb.append("]"); |
85 | 0 | return (sb.toString()); |
86 | } | |
87 | ||
88 | ||
89 | } |