Revision 4:dfb345ef9452, 1.4 KB
(checked in by František Kučera <franta-hg@…>, 15 years ago)
|
Drobnosti a serializace
|
Rev | Line | |
---|
[0] | 1 | package cz.frantovo.postak; |
---|
| 2 | |
---|
| 3 | import java.io.UnsupportedEncodingException; |
---|
| 4 | import javax.mail.Message.RecipientType; |
---|
| 5 | import javax.mail.internet.InternetAddress; |
---|
| 6 | |
---|
| 7 | /** |
---|
| 8 | * Rozšíření InternetAddress tak, aby obsahovala i informaci o typu příjemce: komu, kopie, skrytá |
---|
| 9 | * @author fiki |
---|
| 10 | */ |
---|
| 11 | public class InternetAddressKomu extends InternetAddress { |
---|
[4] | 12 | private static final long serialVersionUID = 5616579686371892208L; |
---|
[0] | 13 | |
---|
| 14 | private RecipientType typ = RecipientType.BCC; |
---|
| 15 | |
---|
| 16 | /** |
---|
| 17 | * Typ příjemce: komu, kopie, skrytý. |
---|
| 18 | * Výchozí hodnota je BCC |
---|
| 19 | */ |
---|
| 20 | public RecipientType getTyp() { |
---|
| 21 | return typ; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | /** |
---|
| 25 | * Typ příjemce: komu, kopie, skrytý. |
---|
| 26 | * Výchozí hodnota je BCC |
---|
| 27 | */ |
---|
| 28 | public void setTyp(RecipientType typ) { |
---|
| 29 | this.typ = typ; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | @Override |
---|
| 33 | public String getPersonal() { |
---|
| 34 | String sup = super.getPersonal(); |
---|
| 35 | if (sup == null || sup.length() < 1) { |
---|
| 36 | return getAddress(); |
---|
| 37 | } else { |
---|
| 38 | return sup; |
---|
| 39 | } |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | public InternetAddressKomu() { |
---|
| 43 | super(); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | /** Výchozí typ příjemce: skrytá kopie */ |
---|
| 47 | public InternetAddressKomu(String adresa, String jmeno) throws UnsupportedEncodingException { |
---|
| 48 | super(adresa, jmeno); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | public InternetAddressKomu(String adresa, String jmeno, RecipientType typ) throws UnsupportedEncodingException { |
---|
| 52 | super(adresa, jmeno); |
---|
| 53 | setTyp(typ); |
---|
| 54 | } |
---|
| 55 | } |
---|