Class PropertyMap.Key<T>

java.lang.Object
com.google.gerrit.server.PropertyMap.Key<T>
Enclosing class:
PropertyMap

public static class PropertyMap.Key<T> extends Object
Typed key for PropertyMap. This class intentionally does not implement Object.equals(Object) and Object.hashCode() so that the same instance has to be used to retrieve a stored value.

We require the exact same key instance because PropertyMap is implemented in a type-safe fashion by using Java generics to guarantee the return type. The generic type can't be recovered at runtime, so there is no way to just use the type's full name as key - we'd have to pass additional arguments. At the same time, this is in-line with how we'd want callers to use PropertyMap: Instantiate a static, per-JVM key that is reused when setting and getting values.

  • Constructor Details

    • Key

      public Key()