AccountCache: Document get and getIfPresent methods
Some callers make wrong assumptions about these methods. Documenting
these methods can help to avoid confusion.
Change-Id: I23b9f69c9e18c8de201f53d2a2db1f1e3aa7075c
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountCache.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountCache.java
index c28021c..9681e8e 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountCache.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountCache.java
@@ -19,8 +19,25 @@
/** Caches important (but small) account state to avoid database hits. */
public interface AccountCache {
+ /**
+ * Returns an {@code AccountState} instance for the given account ID. If not cached yet the
+ * account is loaded. Returns an empty {@code AccountState} instance to represent a missing
+ * account.
+ *
+ * @param accountId ID of the account that should be retrieved
+ * @return {@code AccountState} instance for the given account ID, if no account with this ID
+ * exists an empty {@code AccountState} instance is returned to represent the missing account
+ */
AccountState get(Account.Id accountId);
+ /**
+ * Returns an {@code AccountState} instance for the given account ID if it is present in the
+ * cache.
+ *
+ * @param accountId ID of the account that should be retrieved
+ * @return {@code AccountState} instance for the given account ID if it is present in the cache,
+ * otherwise {@code null}
+ */
AccountState getIfPresent(Account.Id accountId);
AccountState getByUsername(String username);