001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003: * Distributed under the terms of either:
004: * - the common development and distribution license (CDDL), v1.0; or
005: * - the GNU Lesser General Public License, v2.1 or later
006: * $Id: BeanImpl.java 3695 2007-03-16 09:26:50Z gbevin $
007: */
008: package com.uwyn.rife.database;
009:
010: import com.uwyn.rife.database.SomeEnum;
011: import java.math.BigDecimal;
012: import java.sql.Time;
013: import java.sql.Timestamp;
014: import java.util.Calendar;
015:
016: public class BeanImpl {
017: private String mPropertyString = null;
018: private StringBuffer mPropertyStringbuffer = null;
019: private java.util.Date mPropertyDate = null;
020: private java.util.Calendar mPropertyCalendar = null;
021: private java.sql.Date mPropertySqlDate = null;
022: private java.sql.Time mPropertyTime = null;
023: private java.sql.Timestamp mPropertyTimestamp = null;
024: private char mPropertyChar = 0;
025: private Character mPropertyCharacterObject = null;
026: private boolean mPropertyBoolean = false;
027: private Boolean mPropertyBooleanObject = null;
028: private byte mPropertyByte = 0;
029: private Byte mPropertyByteObject = null;
030: private double mPropertyDouble = 0.0d;
031: private Double mPropertyDoubleObject = null;
032: private float mPropertyFloat = 0.0f;
033: private Float mPropertyFloatObject = null;
034: private int mPropertyInt = 0;
035: private Integer mPropertyIntegerObject = null;
036: private long mPropertyLong = 0;
037: private Long mPropertyLongObject = null;
038: private short mPropertyShort = 0;
039: private Short mPropertyShortObject = null;
040: private BigDecimal mPropertyBigDecimal = null;
041: private SomeEnum mPropertyEnum = null;
042:
043: public BeanImpl() {
044: }
045:
046: public String getPropertyString() {
047: return mPropertyString;
048: }
049:
050: public void setPropertyString(String propertyString) {
051: mPropertyString = propertyString;
052: }
053:
054: public StringBuffer getPropertyStringbuffer() {
055: return mPropertyStringbuffer;
056: }
057:
058: public void setPropertyStringbuffer(
059: StringBuffer propertyStringbuffer) {
060: mPropertyStringbuffer = propertyStringbuffer;
061: }
062:
063: public java.util.Date getPropertyDate() {
064: return mPropertyDate;
065: }
066:
067: public void setPropertyDate(java.util.Date propertyDate) {
068: mPropertyDate = propertyDate;
069: }
070:
071: public java.util.Calendar getPropertyCalendar() {
072: return mPropertyCalendar;
073: }
074:
075: public void setPropertyCalendar(java.util.Calendar propertyCalendar) {
076: mPropertyCalendar = propertyCalendar;
077: }
078:
079: public java.sql.Date getPropertySqlDate() {
080: return mPropertySqlDate;
081: }
082:
083: public void setPropertySqlDate(java.sql.Date propertySqlDate) {
084: mPropertySqlDate = propertySqlDate;
085: }
086:
087: public java.sql.Time getPropertyTime() {
088: return mPropertyTime;
089: }
090:
091: public void setPropertyTime(java.sql.Time propertyTime) {
092: mPropertyTime = propertyTime;
093: }
094:
095: public java.sql.Timestamp getPropertyTimestamp() {
096: return mPropertyTimestamp;
097: }
098:
099: public void setPropertyTimestamp(
100: java.sql.Timestamp propertyTimestamp) {
101: mPropertyTimestamp = propertyTimestamp;
102: }
103:
104: public boolean isPropertyBoolean() {
105: return mPropertyBoolean;
106: }
107:
108: public void setPropertyBoolean(boolean propertyBoolean) {
109: mPropertyBoolean = propertyBoolean;
110: }
111:
112: public Boolean getPropertyBooleanObject() {
113: return mPropertyBooleanObject;
114: }
115:
116: public void setPropertyBooleanObject(Boolean propertyBooleanObject) {
117: mPropertyBooleanObject = propertyBooleanObject;
118: }
119:
120: public byte getPropertyByte() {
121: return mPropertyByte;
122: }
123:
124: public Byte getPropertyByteObject() {
125: return mPropertyByteObject;
126: }
127:
128: public void setPropertyByte(byte propertyByte) {
129: mPropertyByte = propertyByte;
130: }
131:
132: public void setPropertyByteObject(Byte propertyByteObject) {
133: mPropertyByteObject = propertyByteObject;
134: }
135:
136: public double getPropertyDouble() {
137: return mPropertyDouble;
138: }
139:
140: public void setPropertyDouble(double propertyDouble) {
141: mPropertyDouble = propertyDouble;
142: }
143:
144: public void setPropertyDoubleObject(Double propertyDoubleObject) {
145: mPropertyDoubleObject = propertyDoubleObject;
146: }
147:
148: public Double getPropertyDoubleObject() {
149: return mPropertyDoubleObject;
150: }
151:
152: public float getPropertyFloat() {
153: return mPropertyFloat;
154: }
155:
156: public void setPropertyFloat(float propertyFloat) {
157: mPropertyFloat = propertyFloat;
158: }
159:
160: public void setPropertyFloatObject(Float propertyFloatObject) {
161: mPropertyFloatObject = propertyFloatObject;
162: }
163:
164: public Float getPropertyFloatObject() {
165: return mPropertyFloatObject;
166: }
167:
168: public int getPropertyInt() {
169: return mPropertyInt;
170: }
171:
172: public void setPropertyInt(int propertyInt) {
173: mPropertyInt = propertyInt;
174: }
175:
176: public Integer getPropertyIntegerObject() {
177: return mPropertyIntegerObject;
178: }
179:
180: public void setPropertyIntegerObject(Integer propertyIntegerObject) {
181: mPropertyIntegerObject = propertyIntegerObject;
182: }
183:
184: public long getPropertyLong() {
185: return mPropertyLong;
186: }
187:
188: public void setPropertyLong(long propertyLong) {
189: mPropertyLong = propertyLong;
190: }
191:
192: public Long getPropertyLongObject() {
193: return mPropertyLongObject;
194: }
195:
196: public void setPropertyLongObject(Long propertyLongObject) {
197: mPropertyLongObject = propertyLongObject;
198: }
199:
200: public short getPropertyShort() {
201: return mPropertyShort;
202: }
203:
204: public void setPropertyShort(short propertyShort) {
205: mPropertyShort = propertyShort;
206: }
207:
208: public Short getPropertyShortObject() {
209: return mPropertyShortObject;
210: }
211:
212: public void setPropertyShortObject(Short propertyShortObject) {
213: mPropertyShortObject = propertyShortObject;
214: }
215:
216: public char getPropertyChar() {
217: return mPropertyChar;
218: }
219:
220: public void setPropertyChar(char propertyChar) {
221: mPropertyChar = propertyChar;
222: }
223:
224: public Character getPropertyCharacterObject() {
225: return mPropertyCharacterObject;
226: }
227:
228: public void setPropertyCharacterObject(
229: Character propertyCharacterObject) {
230: mPropertyCharacterObject = propertyCharacterObject;
231: }
232:
233: public BigDecimal getPropertyBigDecimal() {
234: return mPropertyBigDecimal;
235: }
236:
237: public void setPropertyBigDecimal(BigDecimal propertyBigDecimal) {
238: mPropertyBigDecimal = propertyBigDecimal;
239: }
240:
241: public void setPropertyEnum(SomeEnum propertyEnum) {
242: mPropertyEnum = propertyEnum;
243: }
244:
245: public SomeEnum getPropertyEnum() {
246: return mPropertyEnum;
247: }
248:
249: public static BeanImpl getPopulatedBean() {
250: BeanImpl bean = new BeanImpl();
251: Calendar cal = Calendar.getInstance();
252: cal.set(2002, 5, 18, 15, 26, 14);
253: cal.set(Calendar.MILLISECOND, 764);
254: bean.setPropertyBigDecimal(new BigDecimal("219038743.392874"));
255: bean.setPropertyBoolean(true);
256: bean.setPropertyBooleanObject(false);
257: bean.setPropertyByte((byte) 89);
258: bean.setPropertyByteObject((byte) 34);
259: bean.setPropertyCalendar(cal);
260: bean.setPropertyChar('v');
261: bean.setPropertyCharacterObject('r');
262: bean.setPropertyDate(cal.getTime());
263: bean.setPropertyDouble(53348.34d);
264: bean.setPropertyDoubleObject(143298.692d);
265: bean.setPropertyFloat(98634.2f);
266: bean.setPropertyFloatObject(8734.7f);
267: bean.setPropertyInt(545);
268: bean.setPropertyIntegerObject(968);
269: bean.setPropertyLong(34563L);
270: bean.setPropertyLongObject(66875L);
271: bean.setPropertyShort((short) 43);
272: bean.setPropertyShortObject((short) 68);
273: bean.setPropertySqlDate(new java.sql.Date(cal.getTime()
274: .getTime()));
275: bean.setPropertyString("someotherstring");
276: bean.setPropertyStringbuffer(new StringBuffer(
277: "someotherstringbuff"));
278: bean.setPropertyTime(new Time(cal.getTime().getTime()));
279: bean
280: .setPropertyTimestamp(new Timestamp(cal.getTime()
281: .getTime()));
282: bean.setPropertyEnum(SomeEnum.VALUE_THREE);
283:
284: return bean;
285: }
286:
287: public static BeanImpl getNullBean() {
288: BeanImpl bean = new BeanImpl();
289: bean.setPropertyBigDecimal(null);
290: bean.setPropertyBoolean(false);
291: bean.setPropertyBooleanObject(false);
292: bean.setPropertyByte((byte) 0);
293: bean.setPropertyByteObject((byte) 0);
294: bean.setPropertyDate(null);
295: bean.setPropertyCalendar(null);
296: bean.setPropertyChar((char) 0);
297: bean.setPropertyCharacterObject(null);
298: bean.setPropertyDouble(0d);
299: bean.setPropertyDoubleObject(0d);
300: bean.setPropertyFloat(0f);
301: bean.setPropertyFloatObject(0f);
302: bean.setPropertyInt(0);
303: bean.setPropertyIntegerObject(0);
304: bean.setPropertyLong(0L);
305: bean.setPropertyLongObject(0L);
306: bean.setPropertyShort((short) 0);
307: bean.setPropertyShortObject((short) 0);
308: bean.setPropertySqlDate(null);
309: bean.setPropertyString(null);
310: bean.setPropertyStringbuffer(null);
311: bean.setPropertyTime(null);
312: bean.setPropertyTimestamp(null);
313: bean.setPropertyEnum(null);
314:
315: return bean;
316: }
317: }
|