(no commit message)
[utils] / support / general / src / main / java / org / wamblee / persistence / Persistent.java
1 /*
2  * Copyright 2005-2010 the original author or authors.
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 org.wamblee.persistence;
17
18 import java.io.Serializable;
19
20 /**
21  * Interface for persistent objects. This defines a generic interface for
22  * accessing primary key and version of entities.
23  */
24 public interface Persistent {
25     /**
26      * Gets the primary key.
27      * 
28      * @return Primary key.
29      * 
30      * @see #setPrimaryKey(Serializable)
31      */
32     Serializable getPrimaryKey();
33
34     /**
35      * Sets the primary key.
36      * 
37      * @param aKey
38      *            Primary key.
39      * 
40      * @see #getPrimaryKey()
41      */
42     void setPrimaryKey(Serializable aKey);
43
44     /**
45      * Gets the version.
46      * 
47      * @return Version.
48      * 
49      * @see #setPersistedVersion(int)
50      */
51     Number getPersistedVersion();
52
53     /**
54      * Sets the version.
55      * 
56      * @param aVersion
57      *            Version.
58      * 
59      * @see #getPersistedVersion()
60      */
61     void setPersistedVersion(Number aVersion);
62 }