View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at 
7    * 
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software 
11   * distributed under the License is distributed on an "AS IS" BASIS, 
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License.
15   */
16  
17  /*
18   * ClearLifecycleListener.java
19   *
20   */
21  
22  package javax.jdo.listener;
23  
24  /***
25   * This interface is implemented by listeners to be notified of
26   * clear events.
27   * @version 2.0
28   * @since 2.0
29   */
30  public interface ClearLifecycleListener
31      extends InstanceLifecycleListener {
32  
33      /***
34       * This method is called before the implementation calls the instance
35       *  method {@link ClearCallback#jdoPreClear} and before it clears the values 
36       *  in the instance to their Java default values. This happens during 
37       *  an application call to evict, and in afterCompletion for commit 
38       *  with RetainValues false and rollback with RestoreValues false. 
39       *  <P>The method is called during any state transition to hollow.
40       *  Non-persistent, non-transactional fields should be cleared 
41       *  in this method. Associations between this instance and others 
42       *  in the runtime environment should be cleared. 
43       *  <P>This method is not modified by the enhancer, so access to fields 
44       *  is not mediated.
45       * @param event the clear event.
46       * @since 2.0
47       */
48      void preClear (InstanceLifecycleEvent event);
49      
50      /***
51       * This method is called after the {@link ClearCallback#jdoPreClear} 
52       * method is invoked on the instance and the fields have been cleared 
53       * by the JDO implementation.
54       * @param event the clear event.
55       * @since 2.0
56       */
57      void postClear (InstanceLifecycleEvent event);
58  }