Annotation Interface InternalCanonicalized


@Target(TYPE) public @interface InternalCanonicalized
Marker annotation. If a class is annotated by this annotation, it means that the class applies internal canonicalization and the instances of the class are canonicalized by the class internally.

The annotated classes use the following pattern to canonicalize their instances:

  1. use default equals() and hashCode() (allow fast comparison)
  2. create a private class named Key, which overrides equals() and hashCode()
  3. maintain a hash map from Key to instance
  4. hide constructor, and provide static factory method for obtaining instances, and use the map for canonicalization