01: /*
02: * Copyright 2003 (C) TJDO.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the TJDO License version 1.0.
06: * See the terms of the TJDO License in the documentation provided with this software.
07: *
08: * $Id: NptWidget.java,v 1.1 2003/11/17 01:14:44 jackknifebarber Exp $
09: */
10:
11: package com.triactive.jdo.test.npt;
12:
13: import com.triactive.jdo.test.*;
14:
15: public class NptWidget extends Widget {
16: private int txInteger;
17: private String txString;
18:
19: public NptWidget() {
20: super ();
21: }
22:
23: public int getTxInteger() {
24: return txInteger;
25: }
26:
27: public String getTxString() {
28: return txString;
29: }
30:
31: public void setTxInteger(int txInteger) {
32: this .txInteger = txInteger;
33: }
34:
35: public void setTxString(String txString) {
36: this .txString = txString;
37: }
38:
39: /**
40: * Fills all of the object's fields with random data values. Any non-
41: * primitive fields (with the exception of <code>id</code>) will also be
42: * assigned <code>null</code> on a random basis.
43: */
44:
45: public void fillRandom() {
46: super .fillRandom();
47: fillTxRandom();
48: }
49:
50: /**
51: * Fills the object's non-persistent transactional fields with random data
52: * values. Any non-primitive fields will also be assigned <code>null</code>
53: * on a random basis.
54: */
55:
56: public void fillTxRandom() {
57: txInteger = r.nextInt();
58: txString = nextNull() ? null : nextString(r.nextInt(21));
59: }
60:
61: /**
62: * Returns a string representation for this object. All of the field
63: * values are included in the string for debugging purposes.
64: *
65: * @return a string representation for this object.
66: */
67:
68: public String toString() {
69: StringBuffer s = new StringBuffer(super .toString());
70:
71: s.append(" txInteger = ").append(txInteger);
72: s.append('\n');
73: s.append(" txString = ").append(txString);
74: s.append('\n');
75:
76: return s.toString();
77: }
78: }
|