CurrentUser#getUserName: Return Optional<String> instead of nullable String
This makes it more explicit that callers must handle the case where the returned username is absent. Change-Id: I97e33caa8e9cc8092dc398e3b383d7afd5beb96f Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
		| @@ -19,6 +19,7 @@ import com.google.gerrit.reviewdb.client.Account; | ||||
| import com.google.gerrit.server.account.GroupMembership; | ||||
| import com.google.gerrit.server.account.externalids.ExternalId; | ||||
| import com.google.inject.servlet.RequestScoped; | ||||
| import java.util.Optional; | ||||
| import java.util.function.Consumer; | ||||
|  | ||||
| /** | ||||
| @@ -90,8 +91,8 @@ public abstract class CurrentUser { | ||||
|   public abstract GroupMembership getEffectiveGroups(); | ||||
|  | ||||
|   /** Unique name of the user on this server, if one has been assigned. */ | ||||
|   public String getUserName() { | ||||
|     return null; | ||||
|   public Optional<String> getUserName() { | ||||
|     return Optional.empty(); | ||||
|   } | ||||
|  | ||||
|   /** Check if user is the IdentifiedUser */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Edwin Kempin
					Edwin Kempin