KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > test > InstanceCallbackTester


1 package com.triactive.jdo.test;
2
3 import javax.jdo.InstanceCallbacks;
4
5 public class InstanceCallbackTester implements InstanceCallbacks
6 {
7     private String JavaDoc persistentValue;
8     private String JavaDoc transientValue;
9     public static final String JavaDoc POST_LOAD_VALUE="loaded";
10
11     public void setTransientValue(String JavaDoc s)
12     {
13         this.transientValue = s;
14     }
15
16     public String JavaDoc getTransientValue()
17     {
18         return this.transientValue;
19     }
20
21     public void setPersistentValue(String JavaDoc s)
22     {
23         this.persistentValue = s;
24     }
25
26     public String JavaDoc getPersistentValue()
27     {
28         return this.persistentValue;
29     }
30
31     public void jdoPostLoad()
32     {
33         setTransientValue(POST_LOAD_VALUE);
34     }
35
36     public void jdoPreStore()
37     {
38         setPersistentValue(getTransientValue());
39     }
40
41     public void jdoPreClear()
42     {
43     }
44
45     public void jdoPreDelete()
46     {
47         if (this.transientValue == null)
48             throw new PreDeleteException();
49     }
50 }
51
52
Popular Tags