001 /* 002 * Copyright 2001,2004 The Apache Software Foundation. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.apache.commons.scaffold.util; 018 019 020 /** 021 * Simple JavaBean to represent label-value pairs for use in collections 022 * that are utilized by the <code><form:options></code> tag. 023 * <p> 024 * If you are also use Struts 1.1 or later, you may prefer to use the 025 * [<code>org.apache.struts.util.LabelValueBean</code>] class instead. 026 * The classes are identical. 027 * 028 * @author Craig R. McClanahan 029 * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $ 030 */ 031 032 public class LabelValueBean { 033 034 035 // ----------------------------------------------------------- Constructors 036 037 038 /** 039 * Construct a new LabelValueBean with the specified values. 040 * 041 * @param label The label to be displayed to the user 042 * @param value The value to be returned to the server 043 */ 044 public LabelValueBean(String label, String value) { 045 this.label = label; 046 this.value = value; 047 } 048 049 050 // ------------------------------------------------------------- Properties 051 052 053 /** 054 * The label to be displayed to the user. 055 */ 056 protected String label = null; 057 058 public String getLabel() { 059 return (this.label); 060 } 061 062 063 /** 064 * The value to be returned to the server. 065 */ 066 protected String value = null; 067 068 public String getValue() { 069 return (this.value); 070 } 071 072 073 // --------------------------------------------------------- Public Methods 074 075 076 /** 077 * Return a string representation of this object. 078 */ 079 public String toString() { 080 StringBuffer sb = new StringBuffer("LabelValueBean["); 081 sb.append(this.label); 082 sb.append(", "); 083 sb.append(this.value); 084 sb.append("]"); 085 return (sb.toString()); 086 } 087 088 089 }