You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mailet-api@james.apache.org by Norman Maurer <no...@apache.org> on 2007/05/07 21:14:30 UTC

Re: [jira] Commented: (MAILET-5) Currently our getRecipients expose the internal collection and it is used that way.

I whould like to change this in the next release of mailet api. But 
before that we should tag and release the current mailet stuff because 
the change is not backward compatible.

This is the way i whould fix it:

Add the method:

void addRecipient(MailAddress rec)

And change the getRecipients() methods to use 
Collections.unmodifiableCollection(recipientCol);

WDYT ?

bye
Norman

Norman Maurer (JIRA) schrieb:
>     [ https://issues.apache.org/jira/browse/MAILET-5?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494111 ] 
>
> Norman Maurer commented on MAILET-5:
> ------------------------------------
>
> Moved from JAMES-558
>
>   
>> Currently our getRecipients expose the internal collection and it is used that way.
>> -----------------------------------------------------------------------------------
>>
>>                 Key: MAILET-5
>>                 URL: https://issues.apache.org/jira/browse/MAILET-5
>>             Project: Mailet API
>>          Issue Type: Improvement
>>            Reporter: Norman Maurer
>>         Assigned To: Norman Maurer
>>
>> Currently our getRecipients expose the internal collection and it is used that way.
>> To add recipients we use getRecipients().add(), to store multiple times a single mail to different recipients we get the recipients collection and alter it between store of the mail object (in RemoteDelivery).
>> All of this seems to me bad practice and we should better encapsulate the recipients list in the mail object.
>> Maybe the simple way is to return immutable collections so we'll find bugs as soon as possible and add methods to add and remove recipients directly in the mail interface.
>>     
>
>   


Re: [jira] Commented: (MAILET-5) Currently our getRecipients expose the internal collection and it is used that way.

Posted by Stefano Bagnara <ap...@bago.org>.
Norman Maurer ha scritto:
> I whould like to change this in the next release of mailet api. But
> before that we should tag and release the current mailet stuff because
> the change is not backward compatible.
> 
> This is the way i whould fix it:
> 
> Add the method:
> 
> void addRecipient(MailAddress rec)
> 
> And change the getRecipients() methods to use
> Collections.unmodifiableCollection(recipientCol);
> 
> WDYT ?

The return of Collections.unmodifiableCollection from MailImpl is a
JAMES Server issue and not a Mailet API issue.
On the other side on Mailet's getRecipients() should be noted (javadoc)
that it returns an unmodifiable collection.

Stefano


Re: [jira] Commented: (MAILET-5) Currently our getRecipients expose the internal collection and it is used that way.

Posted by Norman Maurer <no...@apache.org>.
Stefano Bagnara schrieb:
> Norman Maurer ha scritto:
>   
>> I whould like to change this in the next release of mailet api. But
>> before that we should tag and release the current mailet stuff because
>> the change is not backward compatible.
>>
>> This is the way i whould fix it:
>>
>> Add the method:
>>
>> void addRecipient(MailAddress rec)
>>
>> And change the getRecipients() methods to use
>> Collections.unmodifiableCollection(recipientCol);
>>
>> WDYT ?
>>     
>
> The return of Collections.unmodifiableCollection from MailImpl is a
> JAMES Server issue and not a Mailet API issue.
> On the other side on Mailet's getRecipients() should be noted (javadoc)
> that it returns an unmodifiable collection.
>
> Stefano
>
>   

+1
Norman