aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Anatoliy Sablin2017-10-18 23:51:25 +0300
committerGravatar Anatoliy Sablin2017-10-18 23:51:25 +0300
commit89fccaa90b823ea924eb6d2b54fcaf40a0e3bc34 (patch)
tree53d657e667f77484d4601b6aa922fd862c7fc31e
parentab1107c209edc34180397db4614ac3c185d6a52a (diff)
Replaced string concatenation with the StringBuilder.
-rw-r--r--juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java35
1 files changed, 16 insertions, 19 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java b/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java
index 2e10606a..86b4d02e 100644
--- a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java
+++ b/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java
@@ -92,44 +92,41 @@ public class JuickMessage extends com.juick.Message implements StanzaChild {
}
@Override
public String toString() {
- String ret = "";
- ret = "<" + TagName + " xmlns=\"" + XMLNS + "\"";
+ StringBuilder ret = new StringBuilder("<").append(TagName).append(" xmlns=\"").append(XMLNS).append("\"");
if (getMid() > 0) {
- ret += " mid=\"" + getMid() + "\"";
+ ret.append(" mid=\"").append(getMid()).append("\"");
}
if (getRid() > 0) {
- ret += " rid=\"" + getRid() + "\"";
+ ret.append(" rid=\"").append(getRid()).append("\"");
}
if (getReplyto() > 0) {
- ret += " replyto=\"" + getReplyto() + "\"";
+ ret.append(" replyto=\"").append(getReplyto()).append("\"");
}
- ret += " privacy=\"" + getPrivacy() + "\"";
+ ret.append(" privacy=\"").append(getPrivacy()).append("\"");
if (FriendsOnly) {
- ret += " friendsonly=\"1\"";
+ ret.append(" friendsonly=\"1\"");
}
if (ReadOnly) {
- ret += " readonly=\"1\"";
+ ret.append(" readonly=\"1\"");
}
if (getTimestamp() != null) {
- ret += " ts=\"" + df.format(Date.from(getTimestamp())) + "\"";
+ ret.append(" ts=\"").append(df.format(Date.from(getTimestamp()))).append("\"");
}
if (getAttachmentType() != null) {
- ret += " attach=\"" + getAttachmentType() + "\"";
+ ret.append(" attach=\"").append(getAttachmentType()).append("\"");
}
- ret += ">";
+ ret.append(">");
if (getUser() != null) {
- ret += JuickUser.toString(getUser());
+ ret.append(JuickUser.toString(getUser()));
}
if (getText() != null) {
- ret += "<body>" + StringEscapeUtils.escapeXml10(getText()) + "</body>";
+ ret.append("<body>").append(StringEscapeUtils.escapeXml10(getText())).append("</body>");
}
- if (!getTags().isEmpty()) {
- for (Tag Tag : getTags()) {
- ret += "<tag>" + StringEscapeUtils.escapeXml10(Tag.getName()) + "</tag>";
- }
+ for (Tag Tag : getTags()) {
+ ret.append("<tag>").append(StringEscapeUtils.escapeXml10(Tag.getName())).append("</tag>");
}
- ret += "</" + TagName + ">";
- return ret;
+ ret.append("</").append(TagName).append(">");
+ return ret.toString();
}
@Override
public boolean equals(Object obj) {