View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.dbutils;
18  
19  /**
20   * A bean to use in testing toBean() and toBeanList().
21   */
22  public class TestBean {
23  
24      private String one = null;
25  
26      private String two = null;
27  
28      private String three = null;
29  
30      private int intTest = 0;
31  
32      private Integer integerTest = Integer.valueOf(0);
33  
34      private String doNotSet = "not set";
35  
36      /**
37       * toBean() should set primitive fields to their defaults (ie. 0) when
38       * null is returned from the ResultSet.
39       */
40      private int nullPrimitiveTest = 7;
41  
42      /**
43       * toBean() should set Object fields to null when null is returned from the
44       * ResultSet
45       */
46      private Object nullObjectTest = "overwrite";
47  
48      /**
49       * A Date will be returned from the ResultSet but the property is a String.
50       * BeanProcessor should create a String from the Date and set this property.
51       */
52      private String notDate = "not a date";
53  
54      /**
55       * The ResultSet will have a BigDecimal in this column and the
56       * BasicColumnProcessor should convert that to a double and store the value
57       * in this property.
58       */
59      private double columnProcessorDoubleTest = -1;
60  
61      /**
62       * Constructor for TestBean.
63       */
64      public TestBean() {
65          super();
66      }
67  
68      public String getOne() {
69          return one;
70      }
71  
72      public String getThree() {
73          return three;
74      }
75  
76      public String getTwo() {
77          return two;
78      }
79  
80      public void setOne(String string) {
81          one = string;
82      }
83  
84      public void setThree(String string) {
85          three = string;
86      }
87  
88      public void setTwo(String string) {
89          two = string;
90      }
91  
92      public String getDoNotSet() {
93          return doNotSet;
94      }
95  
96      public void setDoNotSet(String string) {
97          doNotSet = string;
98      }
99  
100     public Integer getIntegerTest() {
101         return integerTest;
102     }
103 
104     public int getIntTest() {
105         return intTest;
106     }
107 
108     public void setIntegerTest(Integer integer) {
109         integerTest = integer;
110     }
111 
112     public void setIntTest(int i) {
113         intTest = i;
114     }
115 
116     public Object getNullObjectTest() {
117         return nullObjectTest;
118     }
119 
120     public int getNullPrimitiveTest() {
121         return nullPrimitiveTest;
122     }
123 
124     public void setNullObjectTest(Object object) {
125         nullObjectTest = object;
126     }
127 
128     public void setNullPrimitiveTest(int i) {
129         nullPrimitiveTest = i;
130     }
131 
132     public String getNotDate() {
133         return notDate;
134     }
135 
136     public void setNotDate(String string) {
137         notDate = string;
138     }
139 
140     public double getColumnProcessorDoubleTest() {
141         return columnProcessorDoubleTest;
142     }
143 
144     public void setColumnProcessorDoubleTest(double d) {
145         columnProcessorDoubleTest = d;
146     }
147 
148 }