Package org.silverpeas.core.mail
Class ReceiverMailAddressSet
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<E>
-
- java.util.LinkedHashSet<MailAddress>
-
- org.silverpeas.core.mail.ReceiverMailAddressSet
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<MailAddress>
,Collection<MailAddress>
,Set<MailAddress>
public class ReceiverMailAddressSet extends LinkedHashSet<MailAddress>
ThisLinkedHashSet
implementation handlesMailAddress
data. It permits to define several receiver addresses and following configuration:- the number of receivers to specify for a one send,
DEFAULT_BATCH_SIZE
by default. If the value is less than or equals to zero, then all receivers are specified in a one single send - the recipient type
ReceiverMailAddressSet.MailRecipientType
of the receivers addresses.ReceiverMailAddressSet.MailRecipientType.TO
by default
- Author:
- Yohann Chastagnier
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReceiverMailAddressSet.MailRecipientType
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ReceiverMailAddressSet>
getBatchedReceiversList()
Gets the list of receiver batches according to the defined number of receivers per send batch.String
getEmailsSeparatedByComma()
Gets the list of emails each one separated by a comma.ReceiverMailAddressSet.MailRecipientType
getRecipientType()
Gets the recipient type.static ReceiverMailAddressSet
ofRecipientType(ReceiverMailAddressSet.MailRecipientType mailRecipientType)
Adds severalMailAddress
instances.static ReceiverMailAddressSet
with(Collection<MailAddress> mailAddresses)
Adds severalMailAddress
instances.static ReceiverMailAddressSet
with(MailAddress... mailAddresses)
ReceiverMailAddressSet
withReceiversBatchSizeOf(int receiversBatchSizeForOneSend)
Sets the new number of receivers that must be specified for one send.ReceiverMailAddressSet
withRecipientType(ReceiverMailAddressSet.MailRecipientType recipientType)
Sets a recipient type.-
Methods inherited from class java.util.LinkedHashSet
spliterator
-
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
with
public static ReceiverMailAddressSet with(MailAddress... mailAddresses)
-
with
public static ReceiverMailAddressSet with(Collection<MailAddress> mailAddresses)
Adds severalMailAddress
instances.- Parameters:
mailAddresses
- theMailAddress
instances.- Returns:
- the set instance
-
ofRecipientType
public static ReceiverMailAddressSet ofRecipientType(ReceiverMailAddressSet.MailRecipientType mailRecipientType)
Adds severalMailAddress
instances.- Parameters:
mailRecipientType
- the recipient type to take into account.- Returns:
- the set instance
-
getRecipientType
public ReceiverMailAddressSet.MailRecipientType getRecipientType()
Gets the recipient type.- Returns:
- the recipient type.
-
withRecipientType
public ReceiverMailAddressSet withRecipientType(ReceiverMailAddressSet.MailRecipientType recipientType)
Sets a recipient type. If null,.MailRecipientType#TO
is taken in account by default- Parameters:
recipientType
- the new recipient type to take into account.- Returns:
- the set instance
-
withReceiversBatchSizeOf
public ReceiverMailAddressSet withReceiversBatchSizeOf(int receiversBatchSizeForOneSend)
Sets the new number of receivers that must be specified for one send. If the value is less than or equals to zero, then all receivers will be specified in a one single send.- Parameters:
receiversBatchSizeForOneSend
- the new number of receivers that must be specified for one send.- Returns:
- the set instance
-
getBatchedReceiversList
public List<ReceiverMailAddressSet> getBatchedReceiversList()
Gets the list of receiver batches according to the defined number of receivers per send batch.- Returns:
- the batched receiver list.
-
getEmailsSeparatedByComma
public String getEmailsSeparatedByComma()
Gets the list of emails each one separated by a comma.- Returns:
- the list of emails each one separated by a comma.
-
-