View Javadoc

1   /* Copyright 2004 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.acl.basic;
17  
18  import java.io.Serializable;
19  
20  
21  /***
22   * Interface representing the identity of an individual domain object instance.
23   * 
24   * <P>
25   * It should be noted that <code>AclObjectIdentity</code> instances are created
26   * in various locations throughout the package. As
27   * <code>AclObjectIdentity</code>s are used as the key for caching, it is
28   * essential that implementations provide methods so that object-equality
29   * rather than reference-equality can be relied upon by caches. In other
30   * words, a cache can consider two <code>AclObjectIdentity</code>s equal if
31   * <code>identity1.equals(identity2)</code>, rather than reference-equality of
32   * <code>identity1==identity2</code>.
33   * </p>
34   * 
35   * <P>
36   * In practical terms this means you must implement the standard
37   * <code>java.lang.Object</code> methods shown below. Depending on your
38   * cache's internal structure, you may also need to implement special
39   * interfaces such as <code>java.util.Comparator</code> or
40   * <code>java.lang.Comparable</code>.
41   * </p>
42   *
43   * @author Ben Alex
44   * @version $Id: AclObjectIdentity.java,v 1.2 2005/11/17 00:55:47 benalex Exp $
45   */
46  public interface AclObjectIdentity extends Serializable {
47      //~ Methods ================================================================
48  
49      /***
50       * Refer to the <code>java.lang.Object</code> documentation for the
51       * interface contract.
52       *
53       * @param obj to be compared
54       *
55       * @return <code>true</code> if the objects are equal, <code>false</code>
56       *         otherwise
57       */
58      public boolean equals(Object obj);
59  
60      /***
61       * Refer to the <code>java.lang.Object</code> documentation for the
62       * interface contract.
63       *
64       * @return a hash code representation of this object
65       */
66      public int hashCode();
67  }