View Javadoc

1   /*
2    * Copyright 2004 Charles Blaxland
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  package mnemosyne.core;
17  
18  import java.io.Serializable;
19  
20  /***
21   * Implementation of Persistable for classes which want to provide their own
22   * method "interception", rather than letting the AOP system do it.  This is
23   * mainly useful for core classes that must always be Persistable (such as
24   * "PersistentRootImpl") as it prevents the core classes from having to be tied
25   * particular aop system by the user.
26   *
27   * @version $Id: NonAopPersistable.java,v 1.1 2004/08/12 14:01:05 charlesblaxland Exp $
28   */
29  public class NonAopPersistable implements Persistable, Cloneable, Serializable
30  {
31      private transient PersistentObject persistentObject;
32      private transient boolean archiveVersion = false;
33  
34      public PersistentObject getPersistentObject()
35      {
36          return persistentObject;
37      }
38  
39      public void setPersistentObject(PersistentObject persistentObject)
40      {
41          this.persistentObject = persistentObject;
42      }
43  
44      public boolean isPersistent()
45      {
46          return persistentObject != null;
47      }
48  
49      public boolean isArchiveVersion()
50      {
51          return archiveVersion;
52      }
53  
54      public void setArchiveVersion(boolean archiveVersion)
55      {
56          this.archiveVersion = archiveVersion;
57      }
58  }