Spring Security Framework

org.springframework.security.acls.objectidentity
Interface ObjectIdentity

All Superinterfaces:
Serializable
All Known Implementing Classes:
ObjectIdentityImpl

public interface ObjectIdentity
extends Serializable

Represents the identity of an individual domain object instance.

As implementations of ObjectIdentity are used as the key to represent domain objects in the ACL subsystem, it is essential that implementations provide methods so that object-equality rather than reference-equality can be relied upon reliably. In other words, the ACL subsystem can consider two ObjectIdentitys equal if identity1.equals(identity2), rather than reference-equality of identity1==identity2.

Version:
$Id$
Author:
Ben Alex

Method Summary
 boolean equals(Object obj)
           
 Serializable getIdentifier()
          Obtains the actual identifier.
 Class getJavaType()
          Obtains the Java type represented by the domain object.
 int hashCode()
           
 

Method Detail

equals

boolean equals(Object obj)
Overrides:
equals in class Object
Parameters:
obj - to be compared
Returns:
true if the objects are equal, false otherwise
See Also:
Object.equals(Object)

getIdentifier

Serializable getIdentifier()
Obtains the actual identifier. This identifier must not be reused to represent other domain objects with the same javaType.

Because ACLs are largely immutable, it is strongly recommended to use a synthetic identifier (such as a database sequence number for the primary key). Do not use an identifier with business meaning, as that business meaning may change in the future such change will cascade to the ACL subsystem data.

Returns:
the identifier (unique within this javaType; never null)

getJavaType

Class getJavaType()
Obtains the Java type represented by the domain object. The Java type can be an interface or a class, but is most often the domain object implementation class.

Returns:
the Java type of the domain object (never null)

hashCode

int hashCode()
Overrides:
hashCode in class Object
Returns:
a hash code representation of the ObjectIdentity
See Also:
Object.hashCode()

Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.