org/rfcs/rfc6122.html">Extensible Messaging and Presence Protocol (XMPP): Address Format.
A JID consists of three parts:
[ localpart "@" ] domainpart [ "/" resourcepart ]
The easiest way to create a JID is to use the {@link #valueOf(String)} method:
Jid jid = Jid.valueOf("juliet@capulet.lit/balcony");
You can then get the parts from it via the respective methods:
String local = jid.getLocal(); // juliet String domain = jid.getDomain(); // capulet.lit String resource = jid.getResource(); // balcony
This class overrides
equals()
and
hashCode()
, so that different instances with the same value are equal:
Jid.valueOf("romeo@capulet.lit/balcony").equals(Jid.valueOf("romeo@capulet.lit/balcony")); // true
This class also supports
XEP-0106: JID Escaping, i.e.
Jid.valueOf("d'artagnan@musketeers.lit")
is escaped as
d\\27artagnan@musketeers.lit
.
@author Christian Schudt