| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EmailToList |
|
| 1.25;1.25 |
| 1 | /* | |
| 2 | * Copyright 2005-2010 The Kuali Foundation | |
| 3 | * | |
| 4 | * | |
| 5 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.opensource.org/licenses/ecl2.php | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.kuali.rice.core.mail; | |
| 18 | import java.util.List; | |
| 19 | import javax.mail.Address; | |
| 20 | import javax.mail.internet.AddressException; | |
| 21 | import javax.mail.internet.InternetAddress; | |
| 22 | ||
| 23 | /** | |
| 24 | * The to addresses of an email message. | |
| 25 | * | |
| 26 | * @author Kuali Rice Team (kuali-rice@googlegroups.com) | |
| 27 | */ | |
| 28 | public class EmailToList { | |
| 29 | ||
| 30 | private List<String> toAddresses; | |
| 31 | ||
| 32 | 0 | public EmailToList(List<String> toAddresses) { |
| 33 | 0 | this.toAddresses = toAddresses; |
| 34 | 0 | } |
| 35 | ||
| 36 | public List<String> getToAddresses() { | |
| 37 | 0 | return toAddresses; |
| 38 | } | |
| 39 | ||
| 40 | public Address[] getToAddressesAsAddressArray() throws AddressException { | |
| 41 | 0 | Address[] recipientAddresses = new Address[this.toAddresses.size()]; |
| 42 | 0 | for (int i = 0; i < recipientAddresses.length; i++) { |
| 43 | 0 | recipientAddresses[i] = new InternetAddress((String) this.toAddresses.get(i)); |
| 44 | } | |
| 45 | 0 | return recipientAddresses; |
| 46 | } | |
| 47 | ||
| 48 | public void setToAddress(List<String> toAddresses) { | |
| 49 | 0 | this.toAddresses = toAddresses; |
| 50 | 0 | } |
| 51 | ||
| 52 | } |