View Javadoc

1   /*
2    * $Id: PojoBean.java 421119 2006-07-12 04:49:11Z wsmoak $
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  package org.apache.struts.validator;
19  
20  import java.util.HashMap;
21  import java.util.Map;
22  
23  /***
24   * Test Bean class.
25   */
26  public class PojoBean {
27      protected String stringValue1;
28      protected String stringValue2;
29      protected int intValue1;
30      protected int intValue2;
31      protected Integer integerValue1;
32      protected Integer integerValue2;
33      protected PojoBean[] beans;
34      protected Map map = new HashMap();
35  
36      /***
37       * Default Constructor
38       */
39      public PojoBean() {
40      }
41  
42      /***
43       * Construct Bean with a pair of String values.
44       */
45      public PojoBean(String stringValue1, String stringValue2) {
46          setStringValue1(stringValue1);
47          setStringValue2(stringValue2);
48      }
49  
50      /***
51       * Construct Bean with a pair of integer values.
52       */
53      public PojoBean(int intValue1, int intValue2) {
54          setIntValue1(intValue1);
55          setIntValue2(intValue2);
56          setIntegerValue1(new Integer(intValue1));
57          setIntegerValue2(new Integer(intValue2));
58      }
59  
60      /***
61       * Set the stringValue1.
62       */
63      public void setStringValue1(String stringValue1) {
64          this.stringValue1 = stringValue1;
65      }
66  
67      /***
68       * Return stringValue1.
69       */
70      public String getStringValue1() {
71          return stringValue1;
72      }
73  
74      /***
75       * Set the stringValue2.
76       */
77      public void setStringValue2(String stringValue2) {
78          this.stringValue2 = stringValue2;
79      }
80  
81      /***
82       * Return stringValue2.
83       */
84      public String getStringValue2() {
85          return stringValue2;
86      }
87  
88      /***
89       * Set the intValue1.
90       */
91      public void setIntValue1(int intValue1) {
92          this.intValue1 = intValue1;
93      }
94  
95      /***
96       * Return intValue1.
97       */
98      public int getIntValue1() {
99          return intValue1;
100     }
101 
102     /***
103      * Set the intValue2.
104      */
105     public void setIntValue2(int intValue2) {
106         this.intValue2 = intValue2;
107     }
108 
109     /***
110      * Return intValue2.
111      */
112     public int getIntValue2() {
113         return intValue2;
114     }
115 
116     /***
117      * Set the integerValue1.
118      */
119     public void setIntegerValue1(Integer integerValue1) {
120         this.integerValue1 = integerValue1;
121     }
122 
123     /***
124      * Return integerValue1.
125      */
126     public Integer getIntegerValue1() {
127         return integerValue1;
128     }
129 
130     /***
131      * Set the integerValue2.
132      */
133     public void setIntegerValue2(Integer integerValue2) {
134         this.integerValue2 = integerValue2;
135     }
136 
137     /***
138      * Return integerValue2.
139      */
140     public Integer getIntegerValue2() {
141         return integerValue2;
142     }
143 
144     /***
145      * Set the PojoBean[].
146      */
147     public void setBeans(PojoBean[] beans) {
148         this.beans = beans;
149     }
150 
151     /***
152      * Return PojoBean[].
153      */
154     public PojoBean[] getBeans() {
155         return beans;
156     }
157 
158     /***
159      * Return and indexed Bean
160      */
161     public PojoBean getBean(int index) {
162         return beans[index];
163     }
164 
165     /***
166      * Return the Map
167      */
168     public Object getMap() {
169         return map;
170     }
171 
172     /***
173      * Return the Map
174      */
175     public void setMap(Map map) {
176         this.map = map;
177     }
178 
179     /***
180      * Set a  Mapped property
181      */
182     public void setMapped(String key, Object value) {
183         map.put(key, value);
184     }
185 
186     /***
187      * Set a  Mapped property
188      */
189     public Object getMapped(String key) {
190         return map.get(key);
191     }
192 }