ClassKey (Jackson: JAX-RS (parent) 2.14.0 API)

com.fasterxml.jackson.jaxrs.util

## Class ClassKey

- java.lang.Object
- - com.fasterxml.jackson.jaxrs.util.ClassKey

- All Implemented Interfaces:
    Comparable<ClassKey>

      public final class ClassKey
      extends Object
      implements Comparable<ClassKey>

  Efficient key class, used instead of using `Class`. 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.

  Since:
    2.2

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(ClassKey other)`
    `boolean` | `equals(Object o)`
    `int` | `hashCode()`
    `void` | `reset(Class<?> clz)`
    `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(Class<?> clz)

  - ### Method Detail

    - #### reset

          public void reset(Class<?> clz)

    - #### compareTo

          public int compareTo(ClassKey other)

      Specified by:
        `compareTo` in interface `Comparable<ClassKey>`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2022 FasterXML. All rights reserved.