View Javadoc

1   /* Copyright 2004, 2005 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.acegisecurity.domain.impl;
17  
18  import java.io.Serializable;
19  
20  /***
21   * A persistable entity that uses a <code>Integer</code> based identity.
22   *
23   * @author Ben Alex
24   * @version $Id: PersistableEntityInteger.java,v 1.5 2005/11/17 00:55:49 benalex Exp $
25   */
26  public abstract class PersistableEntityInteger extends AbstractPersistableEntity {
27      //~ Instance fields ========================================================
28  
29      protected Integer id;
30  
31      //~ Methods ================================================================
32  
33      /***
34       * DO NOT USE DIRECTLY.
35       * 
36       * <p>
37       * Typically only used by the persistence layer, but provided with public
38       * visibility to not limit flexibility.
39       * </p>
40       *
41       * @param id the new instance identity
42       */
43      public void setId(Integer id) {
44          this.id = id;
45      }
46  
47      /***
48       * Obtains the persistence identity of this instance.
49       * 
50       * <p>Marked as abstract to remind users to implement. They'll need to implement
51       * so their annotations reflect the correct sequence name.
52       */
53      public abstract Integer getId();
54  
55      /***
56       * DO NOT USE DIRECTLY.
57       * 
58       * <p>
59       * Use {@link #getId()} instead, as it provides the correct return type.
60       * This method is only provided for use by the persistence layer and to
61       * satisfy the {@link org.acegisecurity.domain.PersistableEntity}
62       * interface contract.
63       * </p>
64       * 
65       * <p>
66       * Internally delegates to {@link #getId()}.
67       * </p>
68       *
69       * @return the instance's identity
70       */
71      public Serializable getInternalId() {
72          return this.getId();
73      }
74  }