Danny Angus wrote:
The matcher shouldn't modify the content of the mail, but it will
return a collection of recipients which match the condition. If this
is < the whole set of recipients it will split the message in two so
that one has the matched recipients and one has the rest.
For example if a message is destined for both local and remote
delivery a copy with local recipients and one with remote is created.
They *both* continue along the rest of the processing unless they are
stopped for some reason, the net result is that the mail can move down
more than one path of processing. This makes sense if you think about
it.
Original -> Local -> spam check -> virusscan -> local delivery
Original -> Remote -> add habeas -> add footer -> remote delivery
I don't believe in "shouldn't" with user api design. If the something
shouldn't modify the mail then something like:
public interface ImmutableMail {
String getFoo();
}
public class ImmutableMailImpl implements ImmutableMail {
private Mail mail;
public ImmutableMailImpl(Mail mail) {
this.mail = mail;
}
}
There are lazy tricks you can do with Proxy to just call methods in the
interface that constructed it but not outside if
you don't want to do a bridge. Some things have to be done with deep
classes and there
are always efficiency compromises, but you get the idea.
-Andy