站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

CacheKey (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.ejb
Class CacheKey

java.lang.Object
  extended byorg.jboss.ejb.CacheKey
All Implemented Interfaces:
Externalizable, Serializable
Direct Known Subclasses:
ListCacheKey

public class CacheKey
extends Object
implements Externalizable

CacheKey is an encapsulation of both the PrimaryKey and a cache specific key.

This implementation is a safe implementation in the sense that it doesn't rely on the user supplied hashcode and equals. It is also fast since the hashCode operation is pre-calculated.

Version:
$Revision: 1.23 $
Author:
Marc Fleury, Bill Burke, Scott Stark
See Also:
org.jboss.ejb.plugins.NoPassivationInstanceCache.java, EntityInstanceCache, org.jboss.ejb.plugins.EntityProxy, Serialized Form

Field Summary
protected  int hashCode
          The Marshalled Object's hashcode
protected  Object id
          The database primaryKey.
protected  MarshalledObject mo
          The Marshalled Object representing the key
 
Constructor Summary
CacheKey()
           
CacheKey(Object id)
           
 
Method Summary
 boolean equals(Object object)
          This method uses the id implementation of equals if the mo is null since this indicates that the id class did implement equals.
 Object getId()
           
 int hashCode()
          these should be overwritten by extending Cache key since they define what the cache does in the first place
 void readExternal(ObjectInput in)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected Object id
The database primaryKey. This primaryKey is used by: org.jboss.ejb.plugins.EntityInstanceCache.setKey() - to set the EntityEnterpriseContext id org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(): - implementing Entity.toString() --> cacheKey.getId().toString() - implementing Entity.hashCode() --> cacheKey.getId().hashCode() - etc... org.jboss.ejb.plugins.local.BaseLocalProxyFactory.EntityProxy.getId()


mo

protected MarshalledObject mo
The Marshalled Object representing the key


hashCode

protected int hashCode
The Marshalled Object's hashcode

Constructor Detail

CacheKey

public CacheKey()

CacheKey

public CacheKey(Object id)
Method Detail

getId

public Object getId()

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

hashCode

public int hashCode()
these should be overwritten by extending Cache key since they define what the cache does in the first place


equals

public boolean equals(Object object)
This method uses the id implementation of equals if the mo is null since this indicates that the id class did implement equals. If mo is not null, then the MarshalledObject equals is used to compare keys based on their serialized form. Relying on the serialized form does not always work.


toString

public String toString()


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.