## org.jboss.util
Class FastKey

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

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

public class FastKey
extends CacheKey
implements java.io.Externalizable

FastKey FastKey is a hack to enable fool proof and fast operation of caches for Entity In the case of complex PK if a developer misses hash and equals the maps won't properly work in jboss. Here we provide an wrapper to the DB Key and the hash is over-written so that we never miss a hit in cache and have constant speed.

Version:
  $Revision: 1.8 $
Author:
  Marc Fleury
See Also:
  `org.jboss.ejb.plugins.NoPassivationInstanceCache.java`, Serialized Form

Field Summary
`protected java.lang.Long` `fastKey`

Fields inherited from class org.jboss.ejb.CacheKey
`hashCode, id, mo`

Constructor Summary
`FastKey()`
`FastKey(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` `getPrimaryKey()`
`int` `hashCode()` these should be overwritten by extending Cache key since they define what the cache does in the first place
`protected java.lang.Long` `nextFastKey()`
`void` `readExternal(java.io.ObjectInput in)`
`void` `writeExternal(java.io.ObjectOutput out)`

Methods inherited from class org.jboss.ejb.CacheKey
`getId, toString`

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

Field Detail

### fastKey

    protected java.lang.Long fastKey

Constructor Detail

### FastKey

    public FastKey()

### FastKey

    public FastKey(java.lang.Object id)

Method Detail

### getPrimaryKey

    public java.lang.Object getPrimaryKey()

### nextFastKey

    protected java.lang.Long nextFastKey()

### writeExternal

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

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`
  Overrides:
    `writeExternal` in class `CacheKey`

### readExternal

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

  Specified by:
    `readExternal` in interface `java.io.Externalizable`
  Overrides:
    `readExternal` in class `CacheKey`

### hashCode

    public int hashCode()

  Description copied from class: `CacheKey`
  these should be overwritten by extending Cache key since they define what the cache does in the first place
  Overrides:
    `hashCode` in class `CacheKey`

### equals

    public boolean equals(java.lang.Object object)

  Description copied from class: `CacheKey`
  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 `CacheKey`

Copyright © 2000 The JBoss Organization. All Rights Reserved.