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      public enum Ordinal {
25  
26          THREE, SIX;
27  
28      };
29  
30      private String one = null;
31  
32      private String two = null;
33  
34      private Ordinal three = null;
35  
36      private int intTest = 0;
37  
38      private Integer integerTest = Integer.valueOf(0);
39  
40      // UNUSED private Timestamp timestamp = null;
41  
42      private String doNotSet = "not set";
43  
44      /**
45       * toBean() should set primitive fields to their defaults (ie. 0) when
46       * null is returned from the ResultSet.
47       */
48      private int nullPrimitiveTest = 7;
49  
50      /**
51       * toBean() should set Object fields to null when null is returned from the
52       * ResultSet
53       */
54      private Object nullObjectTest = "overwrite";
55  
56      /**
57       * A Date will be returned from the ResultSet but the property is a String.
58       * BeanProcessor should create a String from the Date and set this property.
59       */
60      private String notDate = "not a date";
61  
62      /**
63       * The ResultSet will have a BigDecimal in this column and the
64       * BasicColumnProcessor should convert that to a double and store the value
65       * in this property.
66       */
67      private double columnProcessorDoubleTest = -1;
68  
69      /**
70       * Constructor for TestBean.
71       */
72      public TestBean() {
73          super();
74      }
75  
76      public String getOne() {
77          return one;
78      }
79  
80      public Ordinal getThree() {
81          return three;
82      }
83  
84      public String getTwo() {
85          return two;
86      }
87  
88      public void setOne(String string) {
89          one = string;
90      }
91  
92      public void setThree(Ordinal ordinal) {
93          three = ordinal;
94      }
95  
96      public void setTwo(String string) {
97          two = string;
98      }
99  
100     public String getDoNotSet() {
101         return doNotSet;
102     }
103 
104     public void setDoNotSet(String string) {
105         doNotSet = string;
106     }
107 
108     public Integer getIntegerTest() {
109         return integerTest;
110     }
111 
112     public int getIntTest() {
113         return intTest;
114     }
115 
116     public void setIntegerTest(Integer integer) {
117         integerTest = integer;
118     }
119 
120     public void setIntTest(int i) {
121         intTest = i;
122     }
123 
124     public Object getNullObjectTest() {
125         return nullObjectTest;
126     }
127 
128     public int getNullPrimitiveTest() {
129         return nullPrimitiveTest;
130     }
131 
132     public void setNullObjectTest(Object object) {
133         nullObjectTest = object;
134     }
135 
136     public void setNullPrimitiveTest(int i) {
137         nullPrimitiveTest = i;
138     }
139 
140     public String getNotDate() {
141         return notDate;
142     }
143 
144     public void setNotDate(String string) {
145         notDate = string;
146     }
147 
148     public double getColumnProcessorDoubleTest() {
149         return columnProcessorDoubleTest;
150     }
151 
152     public void setColumnProcessorDoubleTest(double d) {
153         columnProcessorDoubleTest = d;
154     }
155 
156 }