Class Emails


  • public class Emails
    extends Object
    Class to access accounts by email.
    • Method Detail

      • getAccountFor

        public com.google.common.collect.ImmutableSet<Account.Id> getAccountFor​(String email)
                                                                         throws IOException
        Returns the accounts with the given email.

        Each email should belong to a single account only. This means if more than one account is returned there is an inconsistency in the external IDs.

        The accounts are retrieved via the external ID cache. Each access to the external ID cache requires reading the SHA1 of the refs/meta/external-ids branch. If accounts for multiple emails are needed it is more efficient to use getAccountsFor(String...) as this method reads the SHA1 of the refs/meta/external-ids branch only once (and not once per email).

        In addition accounts are included that have the given email as preferred email even if they have no external ID for the preferred email. Having accounts with a preferred email that does not exist as external ID is an inconsistency, but existing functionality relies on still getting those accounts, which is why they are included. Accounts by preferred email are fetched from the account index as a fallback for email addresses that could not be resolved using ExternalIds.

        Throws:
        IOException
        See Also:
        getAccountsFor(String...)
      • getAccountForExternal

        public com.google.common.collect.ImmutableSet<Account.Id> getAccountForExternal​(String email)
                                                                                 throws IOException
        Returns the accounts with the given email.

        This method behaves just like getAccountFor(String), except that accounts are not looked up by their preferred email. Thus, this method does not rely on the accounts index.

        Throws:
        IOException