Package org.bgerp.util.mail

# Class Addresses

java.lang.Object
java.util.AbstractMap<jakarta.mail.Message.RecipientType,List<jakarta.mail.internet.InternetAddress>>
java.util.HashMap<jakarta.mail.Message.RecipientType,List<jakarta.mail.internet.InternetAddress>>
org.bgerp.util.mail.Addresses

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Map<jakarta.mail.Message.RecipientType,List<jakarta.mail.internet.InternetAddress>>`

public class Addresses extends HashMap<jakarta.mail.Message.RecipientType,List<jakarta.mail.internet.InternetAddress>>
EMail addresses recipients parser and serializer. Supported recipient types: `TO`, `CC`, `BCC`.

See Also:
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.util.AbstractMap

  `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

  ## Nested classes/interfaces inherited from interface java.util.Map

  `Map.Entry<K,V>`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Addresses()`
  `Addresses(String addresses)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Addresses`
  `addTo(String value)`
  Appends an email as recipient `TO` address.
  `Addresses`
  `exclude(String value)`
  Deletes an email from all the types of existing addresses.
  `static Addresses`
  `parse(String lang, String addresses)`
  Parses email addresses.
  `static Addresses`
  `parseSafe(String addresses)`
  Parses email addresses.
  `LinkedHashMap<jakarta.mail.Message.RecipientType,jakarta.mail.internet.InternetAddress[]>`
  `recipients()`
  Returns ordered recipients map.
  `String`
  `serialize()`
  Serializes emails to a string like:
  `String`
  `serializeBcc()`
  `String`
  `serializeCc()`
  `String`
  `serializeTo()`

  ### Methods inherited from class java.util.HashMap

  `clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

  ### Methods inherited from class java.util.AbstractMap

  `equals, hashCode, toString`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.util.Map

  `equals, hashCode`

- ## Constructor Details

  - ### Addresses

    public Addresses()

  - ### Addresses

    public Addresses(String addresses)

- ## Method Details

  - ### parse

    public static Addresses parse(String lang, String addresses) throws BGMessageException
    Parses email addresses. Actual format:

        to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..

    Old one:

        to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..

    Parameters:
      `lang` - language for translating message exceptions.
      `addresses` - email addresses string.
    Returns:
      a created instance.
    Throws:
      `BGMessageException` - incorrect email was given in `addresses` and `silent` is `false`.

  - ### parseSafe

    public static Addresses parseSafe(String addresses)
    Parses email addresses. Actual format:

        to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..

    Old one:

        to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..

    Parameters:
      `addresses` - email addresses string.
    Returns:
      a created instance.

  - ### addTo

    public Addresses addTo(String value)
    Appends an email as recipient `TO` address.
    Parameters:
      `value` - the email.
    Returns:

  - ### exclude

    public Addresses exclude(String value)
    Deletes an email from all the types of existing addresses.
    Parameters:
      `value` - the email.
    Returns:

  - ### serializeTo

    public String serializeTo()

  - ### serializeCc

    public String serializeCc()

  - ### serializeBcc

    public String serializeBcc()

  - ### serialize

    public String serialize()
    Serializes emails to a string like:

        to1, to2..,CC: cc1, cc2..,BCC: bcc1, bcc2..

    Returns:
      the string.

  - ### recipients

    public LinkedHashMap<jakarta.mail.Message.RecipientType,jakarta.mail.internet.InternetAddress[]> recipients()
    Returns ordered recipients map. First `TO`, than `CC` and `BCC`.
    Returns: