package org.androxmpp;
public class XMPPAccount {
String xid;
String password;
String resource;
String host;
int port;
public XMPPAccount(String xid, String password, String resource, String host, int port) {
setXid(xid);
setPassword(password);
setResource(resource);
setHost(host);
setPort(port);
}
public XMPPAccount(String xid, String password, String resource, String host, Integer port) {
setXid(xid);
setPassword(password);
setResource(resource);
setHost(host);
setPort(port);
}
public XMPPAccount(String xid, String password, String resource, String host, String port) {
setXid(xid);
setPassword(password);
setResource(resource);
setHost(host);
setPort(port);
}
public XMPPAccount(String xid, String password, String resource, String host) {
this(xid, password, resource, host, 0);
}
public XMPPAccount(String xid, String password, String resource) {
this(xid, password, resource, null, 0);
}
public XMPPAccount(String xid, String password) {
this(xid, password, null, null, 0);
}
public XMPPAccount(String xid) {
this(xid, null, null, null, 0);
}
public String getXid() {
return this.xid;
}
public XMPPAccount setXid(String xid) {
this.xid = xid;
return this;
}
public boolean passwordIsNull() {
return password == null;
}
public String getPassword() {
return (this.password == null) ? "" : this.password;
}
public XMPPAccount setPassword(String password) {
if (password.equals("")) {
this.password = null;
} else {
this.password = password;
}
return this;
}
public boolean resourceIsNull() {
return resource == null;
}
public String getResource() {
return (this.resource == null) ? "" : this.resource;
}
public XMPPAccount setResource(String resource) {
if (resource == null || resource.equals("")) {
this.resource = "AndroXMPP";
} else {
this.resource = resource;
}
return this;
}
public boolean hostIsNull() {
return host == null;
}
public String getHost() {
return (this.host == null) ? "" : this.host;
}
public XMPPAccount setHost(String host) {
if (host.equals("")) {
this.host = null;
} else {
this.host = host;
}
return this;
}
public int getPort() {
return this.port;
}
public XMPPAccount setPort(int port) {
if (port != 0) {
this.port = port;
} else {
this.port = 5222;
}
return this;
}
public XMPPAccount setPort(Integer port) {
return setPort(port.intValue());
}
public XMPPAccount setPort(String port) {
try {
return setPort(Integer.valueOf(port).intValue());
} catch (NumberFormatException e) {
return setPort(0);
}
}
}
|