JBoss API: Class CacheKey

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.ejb
Class CacheKey

    java.lang.Object
      |
      +--org.jboss.ejb.CacheKey

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable

Direct Known Subclasses:
  FastKey

public class CacheKey
extends java.lang.Object
implements java.io.Externalizable

CacheKey CacheKey is an encapsulation of both the PrimaryKey and a cache specific key This implementation is a safer 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.12.2.2 $
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`
`protected java.lang.Object` | `id`
`protected java.rmi.MarshalledObject` | `mo`

Constructor Summary
`CacheKey()`
`CacheKey(java.lang.Object id)`

Method Summary
`boolean` | `equals(java.lang.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.
`java.lang.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(java.io.ObjectInput in)`
`java.lang.String` | `toString()`
`void` | `writeExternal(java.io.ObjectOutput out)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### id

    protected java.lang.Object id

### mo

    protected java.rmi.MarshalledObject mo

### hashCode

    protected int hashCode

Constructor Detail

### CacheKey

    public CacheKey()

### CacheKey

    public CacheKey(java.lang.Object id)

Method Detail

### getId

    public java.lang.Object getId()

### writeExternal

    public void writeExternal(java.io.ObjectOutput out)
                       throws java.io.IOException

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`

### readExternal

    public void readExternal(java.io.ObjectInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Specified by:
    `readExternal` in interface `java.io.Externalizable`

### hashCode

    public int hashCode()

  these should be overwritten by extending Cache key since they define what the cache does in the first place
  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.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.
  Overrides:
    `equals` in class `java.lang.Object`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000 The JBoss Organization. All Rights Reserved.