mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Add Stanza.hasStanzaIdSet()
This commit is contained in:
parent
1190edad0f
commit
e0a2441c62
1 changed files with 15 additions and 0 deletions
|
@ -119,6 +119,9 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
* @param id the unique ID for the packet.
|
||||
*/
|
||||
public void setStanzaId(String id) {
|
||||
if (id != null) {
|
||||
requireNotNullOrEmpty(id, "id must either be null or not the empty String");
|
||||
}
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
@ -132,6 +135,18 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
setStanzaId(packetID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this stanza has an ID set.
|
||||
*
|
||||
* @return true if the stanza ID is set, false otherwise.
|
||||
* @since 4.1
|
||||
*/
|
||||
public boolean hasStanzaIdSet() {
|
||||
// setStanzaId ensures that the id is either null or not empty,
|
||||
// so we can assume that it is set if it's not null.
|
||||
return id != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns who the packet is being sent "to", or <tt>null</tt> if
|
||||
* the value is not set. The XMPP protocol often makes the "to"
|
||||
|
|
Loading…
Reference in a new issue