aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp/src')
-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) {