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
  • Field Details

    • _className

      private String _className
    • _class

      private Class<?> _class
    • _hashCode

      private int _hashCode
      Let's cache hash code straight away, since we are almost certain to need it.
  • Constructor Details

    • ClassKey

      public ClassKey()
    • ClassKey

      public ClassKey(Class<?> clz)
  • Method Details