KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > bsf > smartValueObject > TestVO


1 package org.bsf.smartValueObject;
2
3 import org.bsf.smartValueObject.container.SmartCollection;
4
5 import java.util.Collection JavaDoc;
6 import java.util.ArrayList JavaDoc;
7
8 /**
9  * Baseclass for TestVOs. Testcases could extend an add
10  * needed behaviour. This VO is a mock for byte code enhanced
11  * VOs to ease testing.
12  */

13 public class TestVO implements Versionable {
14     private Versionable v = new Version();
15
16     // we need public access for testing purposes
17
public int id;
18     public String JavaDoc name;
19     public TestVO otherTestVO;
20     public Collection tests = new SmartCollection(new ArrayList JavaDoc(), new Version());
21
22     public void setId(int id) {
23         touch("id");
24         this.id = id;
25     }
26
27     public int getId() {
28         return this.id;
29     }
30
31     public void setName(String JavaDoc s) {
32         touch("name");
33         this.name = s;
34     }
35
36     public String JavaDoc getName() {
37         return this.name;
38     }
39
40     public void setOtherTestVO(TestVO test) {
41         touch("otherTestVO");
42         otherTestVO = test;
43     }
44
45     public boolean addTestVO(TestVO test) {
46         return tests.add(test);
47     }
48
49     public boolean removeTestVO(TestVO test) {
50         return tests.remove(test);
51     }
52
53     public void touch() {
54         v.touch();
55     }
56
57     public void touch(String JavaDoc field) {
58         v.touch(field);
59     }
60
61     public void delete() {
62         v.delete();
63     }
64
65     public void create() {
66         v.create();
67     }
68
69     public boolean isCreated() {
70         return v.isCreated();
71     }
72
73     public boolean isDeleted() {
74         return v.isDeleted();
75     }
76
77     public boolean isDirty() {
78         return v.isDirty();
79     }
80
81     public void markClean() {
82         v.markClean();
83     }
84
85     /**
86      * Gets the version number.
87      */

88     public long getVersionId() {
89         return v.getVersionId();
90     }
91
92     public void setVersionId(long id) {
93         v.setVersionId(id);
94     }
95
96     public String JavaDoc toString() {
97         return "TestVO: id=" + id;
98     }
99 }
Popular Tags