Class EmailAddressBook


  • public class EmailAddressBook
    extends Object
    Helper class for email addresses.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • EmailAddressBook

        public EmailAddressBook()
    • Method Detail

      • getProperties

        public Properties getProperties()
        Returns the properties, loads them if necessary.
        Returns:
        the properties
      • save

        public boolean save()
        Saves the properties.
      • addContact

        public Object addContact​(EmailContact value)
        Adds the contact to the properties.
        Parameters:
        value - the contact to add
      • getContact

        public EmailContact getContact​(EmailAddress address)
        Returns the contact associated with the email address, null if not found.
        Parameters:
        address - the email address to look up
        Returns:
        the contact, or null if not found
      • getContact

        public EmailContact getContact​(EmailAddress address,
                                       EmailContact defValue)
        Returns the contact associated with the given email address, the default value if not found.
        Parameters:
        address - the email address to look up
        Returns:
        the contact, or the default if not found
      • getContacts

        public List<EmailContact> getContacts()
        Returns all stored contacts.
        Returns:
        the contacts
      • fromString

        public static EmailContact fromString​(String s)
        Turns the string obtained from the properties file into an object.
        Parameters:
        s - the string to parse
        Returns:
        the generated object, null if failed to generate
      • createKey

        public static String createKey​(EmailContact value)
        Generates a property key for the contact.
        Parameters:
        value - the object to generate the key for
        Returns:
        the generated key
      • toString

        public static String toString​(EmailContact value)
        Turns the object into a string to be stored in the properties file.
        Parameters:
        value - the object to convert
        Returns:
        the generated string
      • getSingleton

        public static EmailAddressBook getSingleton()
        Returns the singleton.
        Returns:
        the singleton