Package mireka.filter.local.table

Source Code of mireka.filter.local.table.RecipientTable

package mireka.filter.local.table;

import java.util.ArrayList;
import java.util.List;

import mireka.address.Recipient;
import mireka.destination.Destination;

/**
* RecipientTable contains a list of other {@link RecipientDestinationMapper}
* instances, and search each element of the list to lookup the destination
* assigned to a recipient.
*/
public class RecipientTable implements RecipientDestinationMapper {
    private final List<RecipientDestinationMapper> mappers =
            new ArrayList<RecipientDestinationMapper>();

    @Override
    public Destination lookup(Recipient recipient) {
        for (RecipientDestinationMapper mapper : mappers) {
            Destination destination = mapper.lookup(recipient);
            if (destination != null)
                return destination;
        }
        return null;
    }

    public void addMapper(RecipientDestinationMapper mapper) {
        mappers.add(mapper);
    }

}
TOP

Related Classes of mireka.filter.local.table.RecipientTable

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.