01: /**********************************************************************
02: Copyright (c) 2006 Andy Jefferson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: 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: Contributors:
16: ...
17: **********************************************************************/package org.jpox.identity;
18:
19: /**
20: * Interface for a datastore-identity class to implement.
21: * Please refer to the JDO2 specification 5.4.3 for precise requirements of such a class. These include
22: * <ul>
23: * <li>Has to implement Serializable</li>
24: * <li>Serializable fields have to be public</li>
25: * <li>Has to have a constructor taking a String (the same String that toString() returns)</li>
26: * </ul>
27: *
28: * @version $Revision: 1.1 $
29: */
30: public interface OID {
31: /**
32: * Provides the OID in a form that can be used by the database as a key.
33: * @return The key value
34: */
35: public abstract Object getKeyValue();
36:
37: /**
38: * Accessor for the PC class name
39: * @return the PC Class
40: */
41: public abstract String getPcClass();
42:
43: /**
44: * Equality operator.
45: * @param obj Object to compare against
46: * @return Whether they are equal
47: */
48: public abstract boolean equals(Object obj);
49:
50: /**
51: * Accessor for the hashcode
52: * @return Hashcode for this object
53: */
54: public abstract int hashCode();
55:
56: /**
57: * Returns the string representation of the OID.
58: * The string representation should contain enough information to be usable as input to a String constructor
59: * to create the OID.
60: * @return the string representation of the OID.
61: */
62: public abstract String toString();
63: }
|