public class

ObjectIdentityImpl

extends Object
implements ObjectIdentity
java.lang.Object
   ↳ org.springframework.security.acls.domain.ObjectIdentityImpl

Class Overview

Simple implementation of ObjectIdentity.

Uses Strings to store the identity of the domain object instance. Also offers a constructor that uses reflection to build the identity information.

Summary

Public Constructors
ObjectIdentityImpl(String type, Serializable identifier)
ObjectIdentityImpl(Class<?> javaType, Serializable identifier)
Constructor which uses the name of the supplied class as the type property.
ObjectIdentityImpl(Object object)
Creates the ObjectIdentityImpl based on the passed object instance.
Public Methods
boolean equals(Object arg0)
Important so caching operates properly.
Serializable getIdentifier()
Obtains the actual identifier.
String getType()
Obtains the "type" metadata for the domain object.
int hashCode()
Important so caching operates properly.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.security.acls.model.ObjectIdentity

Public Constructors

public ObjectIdentityImpl (String type, Serializable identifier)

public ObjectIdentityImpl (Class<?> javaType, Serializable identifier)

Constructor which uses the name of the supplied class as the type property.

public ObjectIdentityImpl (Object object)

Creates the ObjectIdentityImpl based on the passed object instance. The passed object must provide a getId() method, otherwise an exception will be thrown.

The class name of the object passed will be considered the #type, so if more control is required, a different constructor should be used.

Parameters
object the domain object instance to create an identity for.
Throws
IdentityUnavailableException if identity could not be extracted

Public Methods

public boolean equals (Object arg0)

Important so caching operates properly.

Considers an object of the same class equal if it has the same classname and id properties.

Numeric identities (Integer and Long values) are considered equal if they are numerically equal. Other serializable types are evaluated using a simple equality.

Parameters
arg0 object to compare
Returns
  • true if the presented object matches this object

public 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 type; never null)

public String getType ()

Obtains the "type" metadata for the domain object. This will often be a Java type name (an interface or a class) – traditionally it is the name of the domain object implementation class.

Returns
  • the "type" of the domain object (never null).

public int hashCode ()

Important so caching operates properly.

Returns
  • the hash

public String toString ()