KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > test > npt > NptWidget


1 /*
2  * Copyright 2003 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: NptWidget.java,v 1.1 2003/11/17 01:14:44 jackknifebarber Exp $
9  */

10
11 package com.triactive.jdo.test.npt;
12
13 import com.triactive.jdo.test.*;
14
15
16 public class NptWidget extends Widget
17 {
18     private int txInteger;
19     private String JavaDoc txString;
20
21
22     public NptWidget()
23     {
24         super();
25     }
26
27
28     public int getTxInteger()
29     {
30         return txInteger;
31     }
32
33
34     public String JavaDoc getTxString()
35     {
36         return txString;
37     }
38
39
40     public void setTxInteger(int txInteger)
41     {
42         this.txInteger = txInteger;
43     }
44
45
46     public void setTxString(String JavaDoc txString)
47     {
48         this.txString = txString;
49     }
50
51
52     /**
53      * Fills all of the object's fields with random data values. Any non-
54      * primitive fields (with the exception of <code>id</code>) will also be
55      * assigned <code>null</code> on a random basis.
56      */

57
58     public void fillRandom()
59     {
60         super.fillRandom();
61         fillTxRandom();
62     }
63
64
65     /**
66      * Fills the object's non-persistent transactional fields with random data
67      * values. Any non-primitive fields will also be assigned <code>null</code>
68      * on a random basis.
69      */

70
71     public void fillTxRandom()
72     {
73         txInteger = r.nextInt();
74         txString = nextNull() ? null : nextString(r.nextInt(21));
75     }
76
77
78     /**
79      * Returns a string representation for this object. All of the field
80      * values are included in the string for debugging purposes.
81      *
82      * @return a string representation for this object.
83      */

84
85     public String JavaDoc toString()
86     {
87         StringBuffer JavaDoc s = new StringBuffer JavaDoc(super.toString());
88
89         s.append(" txInteger = ").append(txInteger);
90         s.append('\n');
91         s.append(" txString = ").append(txString);
92         s.append('\n');
93
94         return s.toString();
95     }
96 }
97
Popular Tags