ClassKey
Date: 2016-12-04

com.fasterxml.jackson.databind.type

## Class ClassKey

- java.lang.Object
- - com.fasterxml.jackson.databind.type.ClassKey

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ClassKey>

      public final class ClassKey
      extends java.lang.Object
      implements java.lang.Comparable<ClassKey>, java.io.Serializable

  Key class, used as an efficient and accurate key for locating per-class values, such as `JsonSerializer`s.

  The reason for having a separate key class instead of directly using `Class` as key is mostly to allow for redefining `hashCode` method -- for some strange reason, `Class` does not redefine `Object.hashCode()` and thus uses identity hash, which is pretty slow. This makes key access using `Class` unnecessarily slow.

  Note: since class is not strictly immutable, caller must know what it is doing, if changing field values.

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassKey()`
    `ClassKey(java.lang.Class<?> clz)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(ClassKey other)`
    `boolean` | `equals(java.lang.Object o)`
    `int` | `hashCode()`
    `void` | `reset(java.lang.Class<?> clz)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ClassKey

          public ClassKey()

    - #### ClassKey

          public ClassKey(java.lang.Class<?> clz)

  - ### Method Detail

    - #### reset

          public void reset(java.lang.Class<?> clz)

    - #### compareTo

          public int compareTo(ClassKey other)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<ClassKey>`

    - #### equals

          public boolean equals(java.lang.Object o)

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

    - #### hashCode

          public int hashCode()

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

    - #### toString

          public java.lang.String toString()

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