?? gmsendmailbody.java
字號(hào):
package siuying.gm.structure;
import java.util.*;
/**
* Message body of an outgoing mail
* @author siuying
* @version 0.2
*/
public class GMSendMailBody {
private String subject;
private String msgbody;
private String draft;
private String th;
private String rm;
private ArrayList to;
private ArrayList cc;
private ArrayList bcc;
private ArrayList attachment;
public GMSendMailBody() {
draft = "";
subject = "";
msgbody = "";
rm = "";
th = "";
to = new ArrayList();
cc = new ArrayList();
bcc = new ArrayList();
attachment = new ArrayList();
}
public boolean equals(GMSendMailBody object){
return subject.equals(object.getSubject()) &&
msgbody.equals(object.getMsgbody()) &&
rm.equals(object.getRm()) &&
th.equals(object.getTh()) &&
draft.equals(object.getDraft());
}
/**
* Textual representation of this mail
* @return simplify text represetation of this outgoing mail
* @todo make it a MIME mail message
*/
public String toString(){
return "[ subject=" + subject +
", body=" + msgbody +
", rm=" + rm +
", th=" + th +
", draft=" + draft +
" ]";
}
/**
* Add a to receiver
* @param address
*/
public void addTo(String address) {
to.add(address);
}
/**
* Add a cc receiver
* @param address
*/
public void addCc(String address) {
cc.add(address);
}
/**
* Add a bcc receiver
* @param address
*/
public void addBcc(String address) {
bcc.add(address);
}
/**
* Add an attachment
* @param file full local path to the attachment file
*/
public void addAttachment(String file){
attachment.add(file);
}
/**
* Get all attachments in a String array
* @return String[]
*/
public String[] getAttachment(){
return (String[]) attachment.toArray(new String[0]);
}
public String[] getTo() {
return (String[]) to.toArray(new String[0]);
}
public String getToAsString(){
StringBuffer buf = new StringBuffer();
for(int i=0; i<to.size(); i++){
buf.append(to.get(i));
if (i<to.size()-1) buf.append(';');
}
return buf.toString();
}
public String[] getCc() {
return (String[]) cc.toArray(new String[0]);
}
public String getCcAsString(){
StringBuffer buf = new StringBuffer();
for(int i=0; i<cc.size(); i++){
buf.append(cc.get(i));
if (i<cc.size()-1) buf.append(';');
}
return buf.toString();
}
public String[] getBcc() {
return (String[]) bcc.toArray(new String[0]);
}
public String getBccAsString(){
StringBuffer buf = new StringBuffer();
for(int i=0; i<bcc.size(); i++){
buf.append(bcc.get(i));
if (i<bcc.size()-1) buf.append(';');
}
return buf.toString();
}
public String getDraft() {
return draft;
}
public String getMsgbody() {
return msgbody;
}
public String getRm() {
return rm;
}
public String getSubject() {
return subject;
}
public String getTh() {
return th;
}
public void setDraft(String draft) {
this.draft = draft;
}
public void setMsgbody(String msgbody) {
this.msgbody = msgbody;
}
public void setRm(String rm) {
this.rm = rm;
}
public void setSubject(String subject) {
this.subject = subject;
}
public void setTh(String th) {
this.th = th;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -