📄 account.java
字号:
/*
* Copyright (C) 2006-2007 Funambol
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.funambol.mailclient;
/**
* This class is a container for the information related to a
* mail account.<p>
*/
public class Account {
//---------------------------------------------------------------- Constants
public static String DEFAULT_URL = "http://<server>:<port>/funambol/ds";
//------------------------------------------------------------- Private Data
/**
* Address of the mail server, specified as a URL.
*/
private String url;
/** Username on the server */
private String user;
/** Password to use */
private String password;
/** Visible Name for this Account */
private String name;
/** Email address for this Account */
private String address;
/**
* Remote URI: it depends on the underlying transport.
* Can be the source URI for syncml, the personal namespace for IMAP, etc.
*/
private String remoteURI;
/** Remote URI for PIM*/
private String pimRemoteURI;
//------------------------------------------------------------- Constructors
/**
* Creates a new instance of Account, with default values.<p>
*/
public Account() {
url = DEFAULT_URL;
user = "";
password = "";
name = "";
address = "";
remoteURI = "mail";
pimRemoteURI = "card";
}
//----------------------------------------------------------- Public Methods
/** Returns the server url. */
public String getUrl() {
return this.url;
}
/** Returns the username for this Account */
public String getUser() {
return this.user;
}
/** Returns the password for this Account */
public String getPassword() {
return this.password;
}
/** Returns the visible name for this Account */
public String getName() {
return this.name;
}
/** Returns the email address name for this Account */
public String getAddress() {
return this.address;
}
/** Returns the remote URI for this Account */
public String getRemoteURI() {
return this.remoteURI;
}
/**
* Address of the mail server, specified as a URL
*/
public void setUrl(String url) {
this.url = url;
}
/** Sets the username for this Account */
public void setUser(String user) {
this.user = user;
}
/** Sets the password for this Account */
public void setPassword(String password) {
this.password = password;
}
/** Sets the visible name for this Account */
public void setName(String name) {
this.name = name;
}
/** Sets the email address name for this Account */
public void setAddress(String addr) {
this.address = addr;
}
/** Sets the the remote URI for this Account */
public void setRemoteURI(String uri) {
this.remoteURI = uri;
}
/** Gets the the remote PIM URI for this Account */
public String getPimRemoteURI() {
return this.pimRemoteURI;
}
/** Sets the the remote PIM URI for this Account */
public void setPimRemoteURI(String pimRemoteURI) {
this.pimRemoteURI = pimRemoteURI;
}
/**
* Returns true if the account has been set.
* The account is considered set if the url is different from DEFAULT_URL
* and if the username and password are not empty.
*/
public boolean isSet() {
if (url.equals(DEFAULT_URL) || "".equals(user) || "".equals(password)) {
return false;
} else {
return true;
}
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("User: ").append(user)
.append("\nUrl: ").append(url)
.append("\nAddress: ").append(address)
//.append("Password: ").append(password)
.append("\nName: ").append(name)
.append("\nRemote URI: ").append(remoteURI)
.append("\nPIM Remote URI: ").append(pimRemoteURI);
return sb.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -