KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > persistence > OID


1 /*
2   Copyright (C) 2001-2004 Laurent Martelli <laurent@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.persistence;
19
20 import org.apache.log4j.Logger;
21
22
23
24 /**
25  * Abstract class that defines an object identifier. It should be
26  * subclassed by <code>Storage</code> implementors.
27  *
28  * <strong>Note that you should also define the <code>hashCode</code>
29  * method.</em>
30  */

31 public abstract class OID implements java.io.Serializable JavaDoc {
32
33     static final Logger logger = Logger.getLogger("persistence");
34
35     /**
36      * Test if two OIDs are equal.
37      * @param obj the OID to test
38      * @return true if obj equals this OID
39      */

40     public abstract boolean equals(Object JavaDoc obj);
41     public abstract int hashCode();
42     
43     public OID(Storage storage) {
44         this.storage = storage;
45         if (storage==null)
46             logger.error("Storage is null",new Exception JavaDoc());
47     }
48
49     /** The storage that defines the OID */
50     protected Storage storage;
51     public final Storage getStorage() {
52         return storage;
53     }
54
55     public abstract String JavaDoc localId();
56 }
57
Popular Tags