1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.domain;
17
18 import java.io.Serializable;
19
20
21 /***
22 * An interface that indicates an object is a <i>persistable entity</i>.
23 *
24 * <p>
25 * A persistable entity is any object that is capable of being persisted,
26 * typically via a {@link org.acegisecurity.domain.dao.Dao} implementation.
27 * </p>
28 *
29 * @author Ben Alex
30 * @version $Id: PersistableEntity.java,v 1.2 2005/11/17 00:56:47 benalex Exp $
31 */
32 public interface PersistableEntity {
33
34
35 /***
36 * Provides a common getter for the persistence layer to obtain an
37 * identity, irrespective of the actual type of identity used.
38 *
39 * <p>
40 * Typically a subclass will delegate to a <code>public
41 * SomePrimitiveWrapper getId()</code> method. The necessity for the
42 * <code>getInternalId()</code> abstract method is solely because the
43 * persistence layer needs a way of obtaining the identity irrespective of
44 * the actual identity implementation choice.
45 * </p>
46 *
47 * <p>
48 * Returning <code>null</code> from this method will indicate the object
49 * has never been saved. This will likely be relied on by some
50 * <code>Dao</code> implementations.
51 * </p>
52 *
53 * @return the persistence identity of this instance
54 */
55 abstract Serializable getInternalId();
56 }