Class Normalizer<T>

java.lang.Object
org.microbean.attributes.Normalizer<T>
Type Parameters:
T - the type of object to be normalized

public final class Normalizer<T> extends Object
A simple, mutable, concurrent, Attributed-aware cache of objects.
Author:
Laird Nelson
See Also:
  • Constructor Details

  • Method Details

    • normalize

      public final T normalize(T element)
      Normalizes the supplied element such that if this Normalizer already has an equivalent cached element, the cached element is returned, and, if it does not, the supplied element is cached indefinitely and returned.

      Note: if the supplied element is an Attributed implementation, then, in accordance with the Attributed contract, it must not include its attributes in its equality or hashcode computations, or undefined behavior may result.

      Parameters:
      element - the element to normalize; may be null in which case null is returned
      Returns:
      the supplied element or a previously cached equivalent element