1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 09:39:39 +02:00

Cleanup carbons, forwarded and a few others API

Adopt to common design patterns in Smack:

- getFrom(Packet) in Packetextensions
- INSTANCES.put() in getInstanceFor()
- ELEMENT instead of ELEMENT_NAME
- Use XmlStringBuilder
This commit is contained in:
Florian Schmaus 2014-07-16 11:46:30 +02:00
parent 1ed5c48bcc
commit 49ee058c38
14 changed files with 105 additions and 90 deletions

View file

@ -160,6 +160,20 @@ public class XmlStringBuilder implements Appendable, CharSequence {
return this;
}
/**
* Add the given attribute if value => 0
*
* @param name
* @param value
* @return a reference to this object
*/
public XmlStringBuilder optLongAttribute(String name, Long value) {
if (value >= 0) {
attribute(name, Long.toString(value));
}
return this;
}
public XmlStringBuilder xmlnsAttribute(String value) {
optAttribute("xmlns", value);
return this;