Package com.google.gerrit.server
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 forPropertyMap
. This class intentionally does not implementObject.equals(Object)
andObject.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 usePropertyMap
: Instantiate a static, per-JVM key that is reused when setting and getting values.