KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > validator > PojoBean


1 /*
2  * $Id: PojoBean.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * 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, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.apache.struts.validator;
20
21 import java.util.Map JavaDoc;
22 import java.util.HashMap JavaDoc;
23 import junit.framework.Test;
24 import junit.framework.TestCase;
25 import junit.framework.TestSuite;
26
27 /**
28  * Test Bean class.
29  */

30 public class PojoBean {
31
32     protected String JavaDoc stringValue1;
33
34     protected String JavaDoc stringValue2;
35
36     protected int intValue1;
37
38     protected int intValue2;
39     
40     protected Integer JavaDoc integerValue1;
41     
42     protected Integer JavaDoc integerValue2;
43
44     protected PojoBean[] beans;
45
46     protected Map JavaDoc map = new HashMap JavaDoc();
47     
48     /**
49      * Default Constructor
50      */

51     public PojoBean() {
52     }
53     
54     /**
55      * Construct Bean with a pair of String values.
56      */

57     public PojoBean(String JavaDoc stringValue1, String JavaDoc stringValue2) {
58        setStringValue1(stringValue1);
59        setStringValue2(stringValue2);
60     }
61     
62     /**
63      * Construct Bean with a pair of integer values.
64      */

65     public PojoBean(int intValue1, int intValue2) {
66        setIntValue1(intValue1);
67        setIntValue2(intValue2);
68        setIntegerValue1(new Integer JavaDoc(intValue1));
69        setIntegerValue2(new Integer JavaDoc(intValue2));
70     }
71     
72     /**
73      * Set the stringValue1.
74      */

75     public void setStringValue1(String JavaDoc stringValue1) {
76        this.stringValue1 = stringValue1;
77     }
78     
79     /**
80      * Return stringValue1.
81      */

82     public String JavaDoc getStringValue1() {
83        return stringValue1;
84     }
85     
86     /**
87      * Set the stringValue2.
88      */

89     public void setStringValue2(String JavaDoc stringValue2) {
90        this.stringValue2 = stringValue2;
91     }
92     
93     /**
94      * Return stringValue2.
95      */

96     public String JavaDoc getStringValue2() {
97        return stringValue2;
98     }
99     
100     /**
101      * Set the intValue1.
102      */

103     public void setIntValue1(int intValue1) {
104        this.intValue1= intValue1;
105     }
106     
107     /**
108      * Return intValue1.
109      */

110     public int getIntValue1() {
111        return intValue1;
112     }
113     
114     /**
115      * Set the intValue2.
116      */

117     public void setIntValue2(int intValue2) {
118        this.intValue2= intValue2;
119     }
120     
121     /**
122      * Return intValue2.
123      */

124     public int getIntValue2() {
125        return intValue2;
126     }
127     
128     /**
129      * Set the integerValue1.
130      */

131     public void setIntegerValue1(Integer JavaDoc integerValue1) {
132        this.integerValue1= integerValue1;
133     }
134     
135     /**
136      * Return integerValue1.
137      */

138     public Integer JavaDoc getIntegerValue1() {
139        return integerValue1;
140     }
141     
142     /**
143      * Set the integerValue2.
144      */

145     public void setIntegerValue2(Integer JavaDoc integerValue2) {
146        this.integerValue2= integerValue2;
147     }
148     
149     /**
150      * Return integerValue2.
151      */

152     public Integer JavaDoc getIntegerValue2() {
153        return integerValue2;
154     }
155     
156     /**
157      * Set the PojoBean[].
158      */

159     public void setBeans(PojoBean[] beans) {
160        this.beans = beans;
161     }
162     
163     /**
164      * Return PojoBean[].
165      */

166     public PojoBean[] getBeans() {
167        return beans;
168     }
169     
170     /**
171      * Return and indexed Bean
172      */

173     public PojoBean getBean(int index) {
174        return beans[index];
175     }
176     
177     /**
178      * Return the Map
179      */

180     public Object JavaDoc getMap() {
181        return map;
182     }
183     
184     /**
185      * Return the Map
186      */

187     public void setMap(Map JavaDoc map) {
188        this.map = map;
189     }
190
191     /**
192      * Set a Mapped property
193      */

194     public void setMapped(String JavaDoc key, Object JavaDoc value) {
195        map.put(key, value);
196     }
197
198     /**
199      * Set a Mapped property
200      */

201     public Object JavaDoc getMapped(String JavaDoc key) {
202        return map.get(key);
203     }
204
205 }
206
Popular Tags